CTM has a nice section on that on p 48. 
  • C++ uses whatever garbage was there.
  • Java initializes variables in objects to some default value.
  • Prolog issues an error message.
  • The Java compiler refuses to compile such variables when they are local (as in your example).
  • Oz suspends silently and waits until the variable gets a value.
CTM lists these options in this order, which it considers increasingly admirable. 
 
I think it would be a very nice feature to be able to declare variables to be data flow variables.  But for every variable to be treated this way is quite unintuitive--especially for new Oz programmers.
 
If someone told you, "Try this neat new language," and you typed in what seemed like the simplest of all programs::
declare X
print X+1
and nothing at all happened.  Wouldn't you be confused? Perhaps you even intended to type:
declare X = 5
print X+1
and just forgot the "= 5" part. Wouldn't you expect the language to help you out and wonder why it didn't? No response at all is what you get from a rude clerk when you don't ask for something in exactly the right way.
 
-- Russ
 
On 10/20/05, Torsten Anders <[EMAIL PROTECTED]> wrote:
On 21.10.2005, at 01:18, Russ Abbott wrote:
> I'm surprised at how difficult it seems to be to get my point across.
> A new Oz user faces two problems.
>  
> The first problem is simply to understandthat Oz is *built to
> suspend.*

I assume the new user coming from a mainstream language does not even
think of entering statements where a new variable without any value is
handed to a deterministic function. What do you intuitively expect the
language to do if you type this?

declare X
X + 1

Best,
Torsten

--
Torsten Anders
Sonic Arts Research Centre
Queen's University Belfast (UK)
www.torsten-anders.de


_________________________________________________________________________________
mozart-users mailing list                               [email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users



--
_____________________________________________
Professor, Computer Science
California State University, Los Angeles
o Check out my blog at http://russabbott.blogspot.com/
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to