RE: 'Unknown' and three-valued logic
- Posted by Patrick.Barnes at transgrid.com.au Nov 26, 2002
- 473 views
I can't see ANY need for knowing whether something is initialised. If you want, define a NULL value to put things to when you're finished with them, however if you try to reference an uninitialised value.. (and if your program initialises and uninitialises values arbitrarily, that's quite likely) ..then the user will end up with a lovely application crash. NULL can be anything that the data in question will never be. 0 and kludge values are popular, but those values might be valid data. You could declare everything as object, and for atoms have the null value {}, and for sequences the null value 0. If you REALLY need that functionality, I daresay it'd only be for one or two variables. In that case, you can have a separate boolean to be valid_var ie if valid_var and var = 15 then --if it is initialised and set to 15, valid_var = 0 --set to uninitialised. end if -----Original Message----- From: Derek Parnell [mailto:ddparnell at bigpond.com] Sent: Wednesday, 27 November 2002 10:19 To: EUforum Subject: Re: 'Unknown' and three-valued logic On Tue, 26 Nov 2002 23:55:24 +0100, Rom <kjehas at frisurf.no> wrote: [snip] > What I am trying to point out is that whole problem is created by missing > elements in all(?)current languages.....you cannot state: > > integer a, b > > -- program code > > if not assigned( a) then ..... > and you cannot state: > > unassign( a) I proposed the need for knowing whether or not a variable has been initialized to RDS a long time ago. Also I mentioned the usefulness of setting a variable back to its uninitialized state. RDS declined to incorporate these into the language. It is obvious that the Euphoria interpreter can ALREADY determine if a variable is initialized or not, however there is no programmer access to that information. > > If we accept the there is no hope that any language will accept nil as a > legal value (unless one developes a new one oneself) ...[snip] I have been using the language called Progress since 1985. It has always had the ability to detect and set a variable to the 'unknown' state. > (this is my final position is this discussion) Thank you. -- cheers, Derek Parnell *********************************************************************** authority states them to be the views of TransGrid. TransGrid uses virus scanning software but excludes any liability for viruses contained in any attachment. ***********************************************************************