If there's no special UNDEFINED value, I think the only natural way to say that there's no answer, is to raise an exception.
To me, the basic uglyness with the zerotype solution is that it's not really possible to store the value in mapping. And that it is sometimes automatically degraded to an ordinary zero (say, when stored in a certain global variables?).
/ Niels Möller ()
Previous text:
2003-01-23 01:23: Subject: Re: zero_type() & UNDEFINED and _typeof()
Eh? "There would be"? The code would hardly rewrite itself. Let's say I have a large function called "do_heavy_database_query()" which can return a value, or UNDEFINED if the database doesn't know the answer. Are you suggesting I should duplicate the code and create two functions "do_heavy_database_query_ok()" and "do_heavy_database_query_value()", and then call first the first one to check if the database knows the answer and then the second one to actually get the value? Besides the fact that the database operation would have to be done twice, there is also the problem of atomicity. The database might forget the value between the call to "do_heavy_database_query_ok()" and "do_heavy_database_query_value()".
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)