[Vm-dev] true isReadOnlyObject ~~ false isReadOnlyObject

Eliot Miranda eliot.miranda at gmail.com
Mon Jul 26 14:25:28 UTC 2021


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.

> 
> Cheers,
> Fabio


More information about the Vm-dev mailing list