Re:Show HN: The Shark Programming Language Realease 1.0.0
by shogundev on Friday March 24, 2023 @06:16PM
(#35296428)
Not happening. If you compile something to Lua assigning a key to nil will erase it, python and javascript will keep it. Pheraps making a special NullObject value to fill these slots would be a good idea, but you could not interact seamlessly with the target system and probably get a speed penalty.
Having the exact behavoir in all platforms is not possible in some cases, and these are the cases left 'undefined' in the handbook.
Hope this clears things a bit ;)
Cheers, -Shogun
Re:Show HN: The Shark Programming Language Realease 1.0.0
by trehans on Friday March 24, 2023 @09:43PM
(#35298260)
Why not remove the ability to set a key to the null value then? Raise an error in the compiler. It seems pretty undesirable to have undefined behavior in the language, and if high performance is one of your goals, remove the ability for users to do the low performance things.
I noticed one thing in the handbook:
> Care must be taken if you assign a given key to the null value: some platforms remove keys assigned to null from tables making them invisible to the in and not in operators.
It is really important to specify the exact behaviour and make sure all platforms behave the same way. You can't write portable programs if the behaviour differs from platform to platform.