[Mozart Oz Users] method syntax

Torbjörn Lager lager at ling.gu.se
Wed Mar 7 15:00:36 CET 2001


Is there any reason why Oz couldn't allow more fun syntax in class
definitions? For example

  class A
     attr a:1
     ...
     fun getA @a end
     ...
  end

instead of

  class A
     attr a:1
     ...
     meth getA($) @a end
     ...
  end

which I find slightly ugly (and confusing at first)? (I appreciate the
nesting operator in other contexts, but in this context, it seems
odd..).

Then, given 

  O = {New A init}

getA could be applied to O as in

  {Browse {O getA}}

instead of as in

  {Browse {O getA($)}}

Furthermore, perhaps Oz could allow keyword 'proc' as an alternative to
'meth'. 

  class A
     attr a:1
     ...
     fun getA @a end
     ...
     proc setA(V) a <- V end
     ...
  end

The 'meth' keyword could be kept as it stands, as a 'generalization'
over 'fun' and 'proc'. I realize there may be a problem parsing 'fun'
and 'proc' in this particular syntactic environment, or that there may
be other problems that I just don't see (perhaps default method args
would cause problems?). Also, this is just a very minor thing, and it
may also be a matter of taste. But I thought that since I'm still fairly
new to Oz, I better tell you what confused me at first, before I get
used to the quirks. 

Anyway...

Regards,
Torbjörn

-- 
----------------------------------------------------------------
Torbjörn Lager                  Computational Linguist
Department of Linguistics       Uppsala University
S-751 20 Uppsala                Sweden
Phone: +46 18 471 7860          http://stp.ling.uu.se/~torbjorn/
----------------------------------------------------------------
-
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