[Vm-dev] true isReadOnlyObject ~~ false isReadOnlyObject

Fabio Niephaus lists at fniephaus.com
Mon Jul 26 14:34:11 UTC 2021


Hi Eliot,

On Mon, Jul 26, 2021 at 4:26 PM Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
>
> Hi Fabio,
>
>
> > On Jul 24, 2021, at 3:27 AM, Fabio Niephaus <lists at fniephaus.com> wrote:
> >
> > 
> > Hi all,
> >
> > Just scanned my image for read-only objects and these were all their classes:
> > ByteSymbol UndefinedObject ByteString Array GitStamp True ByteArray.
> >
> > For some reason, False seems to be missing. Hence, this is true:
> > `true isReadOnlyObject ~~ false isReadOnlyObject`
> >
> > Seems like a minor bug somewhere?
>
> Look at my code in the Compiler for setting literals to be read only.  Clearly it makes sense to set read only on array literals (Array, ByteArray, ByteString/WideString, ByteSymbol/WideSymbol) and boxed numbers (LargeXXXXiveInteger, BoxedFloat64), but it makes little sense to set nil, true & false to be read only (they have no mutable state and so are effectively read only any way). I expect you’ll find that my code is too careless and accidentally applies read only ness to nil, false and/or true.
>
> A fix would involve correcting the code and adding a post load action to remove read only ness from nil, false and true.

Sounds reasonable. Since this is your code, would you mind taking care
of this when you have some time?

Many thanks,
Fabio

>
> >
> > Cheers,
> > Fabio


More information about the Vm-dev mailing list