[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion about Collection


Le 05/10/2025 à 14:30, Fabien Bodard a écrit :
Hi Benoit,

I think a standard way to disable the collection autoremoving for null entry will be interesting.

You have used an inherited class to do that in JSON... but finally why not just add a function to the collection instance ?

Dim c as Collection
c.AllowNull = true (Default = false for back compatibilty)

--
Fabien Bodard

I think that it is useless for actual programs. I mean making a difference between "no value" and Null.

I follow that not just in Collection, but everywhere in Gambas. For example, there is no difference between "no string" and a zero-length string.

I had to make the difference with JSON, because (alas), JSON (and Javascript) makes a difference between "no value" (undefined) and null value.

I never found that distinction useful since the first time I wrote my first program when I was... I don't remember... A long time ago.

In Gambas, I only allow "undefined" values with the 'IsMissing()' special function, for optional arguments.

And new trending cult languages (like Rust) tend to forbid at runtime not only undefined, but null too, by detecting them at compilation time.

Regards,

--
Benoît Minisini.


Follow-Ups:
Re: Suggestion about CollectionFabien Bodard <gambas.fr@xxxxxxxxx>
References:
Suggestion about CollectionFabien Bodard <gambas.fr@xxxxxxxxx>