Re: object(x) rethink
- Posted by Igor Kachan <kinz at pe?erlink?ru> Mar 01, 2008
- 747 views
Andy Drummond wrote: > > The Euphoria docs tell me that object(x) always returns True. That makes it > a > bit useless. Especially since if x is NOT an object it crashes Euphoria! > > Would it not be better if object(x) returned True if x was an object and False > if x either was not an object (i.e. something else like a function) or, and > this is what I would like, if x had not yet been assigned a value so, even > though > it might have been declared, it is valueless. > > This should be very easy to implement - just return False rather than > crashing! > > It would be useful for modules which can then detect a first call and initiate > variables, without needing an explicit initialisation call or putting the > assignments in where the variables are declared. > > So what do you worthy pundits think? Hi Andy, I think that object(x) must be true if x was *declared* as object, and now it is true for any declaration of x, which is unexpected behaviour. New behaviour (true if declared) may be more useful than old one, which is just dummy and only can confuse people. Regards, Igor Kachan kinz at peterlink.ru