From: Goldsack, P. <Pat...@hp...> - 2004-02-10 13:13:09
|
There has been a request to provide a NULL data value in the smartfrog language. It is impossible to use java "null" as this cannot be manipulated by the underlying classes, such as hashtable. However, on the surface this is easy: define a new class (say SFNull) and use the keyword NULL such that any attribute definition x NULL; gives the attribute x the value which is an instance of SFNull. (NULL can also used to indicate no extension, so we might decide to use a different keyword, or simply use the syntactic form of comment (1) below.) There are a number of possible refinements... 1) should the definition aName; change its semantics to be the equivalent to NULL? Currently this is equiavalent to aName "aName"; However, I know of no uses of this used to define the string. Normally it is used to indicate either a null value or more often simply attribute existance as a boolean, so we should probably change this. 2) what should be the result of an sfResolve? There are three choices: - return the instance of SFNull; - throw the exception "SmartFrogNullResolutionException", a subclass of "SmartFrogResolutionException", though in this case the difference in result when testing for attribute existance is minimal and awkward to program to; - trap the return of SFNull, and return the java "null" instead Any comments as to the desired semantics would be appreciated. Patrick |