steful model

Johann Höchtl big.john at bigfoot.com
Sun May 12 20:14:00 CEST 2002


Hello!

I would like to comment on my last posting with some thoughts on the 
declarative stateful model in Oz.

I found several computational models equaly implemented in Mozart/Oz, 
whereas the stateful model is a kind of an orphan.

- You have to call a function in order to get a 'variable' of that kind 
({NewCell ..}
- Access and Assignment are implemented through functions too.

On the other side there is the 'encapsulated steful model' (objects) 
where you can easliy create variables of that kind through 'attr'. This 
attributes can be accessed using '@' and assignment happens using <- so 
you have quite 'syntactic sugar'.

In the Saif/Haridi-book assignment to stateful variables outside of  an 
object-scope is described to happen using an imaginary := operator and 
in recent postings to the 'hackers' list this operator is favourized to 
get included into the main language.

My considerations now where: why inventing a new operator when you can 
extend the meaning of '<-' from "assignment to an attribute" more 
generaly to "assignment to stateful data", even outside the scope of a 
class.

My questions are: is there sthg. planed to extend the language to 
operate more euqally with stateful data? Or is the stateful principle 
considered to be a weaker concept than the 'pure declarative model'?

What would still be missing is a seamless way of declaring such 
variables. Within the scope of classes you have 'attr', so the compiler 
knows that state is involved. Outside a class there is curently this 
'ugly' call to NewCell. Maybe a prefix to steful variables would be wise?

local
    A +B
in
    ...

where +B denotes a stateful varaible where assignment can be done using 
<- and access via @.

I know that i'm not in the position of making claims how the language 
should evolve and this would fit more into the hackers list. However i 
do not consider myself beeing a hacker so please take this as 'food for 
thought'.

Regards,
    Johann

BTW: Mozart and the Saif / Haridi book is great and i seldom found a 
users list so welcoming, inviting and helpful! Keep on doing the great work!

-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-users mailing list