Re: Testing for NULL

new topic     » goto parent     » topic index » view thread      » older message » newer message
SDPringle said...

I think there is value in having a distinct type that allow for the dummy value. Naming convention preferences aside I would call it StringOrNull but not String. I would make another type String that would NOT allow NULL.

Yeah, that's probably a better idea. C# allows for this with Nullable Types, so "string?" and "string" are two different things (nullable and non-nullable, respectively).

Too bad "?" isn't a valid type name character in Euphoria. getlost

public type String( object x ) 
    return string(x) 
end type 
 
public type StringOrNull( object x ) 
    return string(x) or equal(x, NULL) 
end type 

-Greg

P.S. I'm not trying to compare Euphoria to C#, just using it as an example to show that such conventions are already established in other languages.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu