Spec#, nullables and more

spir denis.spir at gmail.com
Thu Nov 25 11:21:00 PST 2010


On Thu, 25 Nov 2010 10:54:39 -0600
Ellery Newcomer <ellery-newcomer at utulsa.edu> wrote:

> From a language designer's perspective, I think programmer association 
> of semantic meaning to null (along with null's weak typing) is a more 
> serious problem than npe vulnerabilities.

True! An unfortunately rarely pointed issue and somewhat nebulous to expose.
I had the idea of an UNDEF value on the implementation side that could not be used/assigned explicitely by the programmer. It would just allow idioms like
	if (x) {}	// if x is not undefined...
by beeing under the hood logically equal to false, but any operation, even toString (I mean writeTo ;-) would raise an UndefinedSymbol exception. Since it's not assignable, a programmer cannot load it with app semantics (eg: author name unknown, element not found, invalid color code... whatever). A trial to get the best of both worlds. Just remains the problem of false/UNDEF not beeing distinct in logical expressions.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list