[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestion about Collection
[Thread Prev] | [Thread Next]
- Subject: Re: Suggestion about Collection
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Sun, 5 Oct 2025 20:32:28 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Le 05/10/2025 à 20:25, Fabien Bodard a écrit :
Le dim. 5 oct. 2025 à 19:05, Benoît Minisini <benoit.minisini@gambas- basic.org <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>> a écrit :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, My fault, actually.I started a reply to your email, and in the process, I noticed a design error in my way of passing parameters via a collection.I'm using a 'Value' input that can only be filled in, or null if it's missing... so no worries.
If you want to store a Null value in a Collection, it normally means that somewhere in your code you make a difference between "Null" and "no value". Which is IMHO not a useful distinction to make in a program.
-- Benoît Minisini.
Suggestion about Collection | Fabien Bodard <gambas.fr@xxxxxxxxx> |
Re: Suggestion about Collection | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: Suggestion about Collection | Fabien Bodard <gambas.fr@xxxxxxxxx> |