On 15.03.2006, at 11:43, Raphael Collet wrote:
Torsten Anders wrote:
Is there some fundamental reason, that creators like Class.new and
Functor.new only partly support what their special syntax counterpart
supports?
No. Ideally class ... end should only be syntactic sugar for a call
to Class.new. All non-kernel language features should be like that.
The object system in Oz is a proof of concept, not a polished and
practical system. In practice you cannot define an object in term of
the kernel language.
Having full creator procedures for every syntactic construct which
can be expressed by a procedure would reduce the need for macros.
On the contrary: macros would simply define some syntactic construct
with new keywords. This would allow you to choose the right tradeoff
between syntactic constructs and constructor calls in your code. IMHO
making everything a function call makes the code less readable.
I agree, macros allow for syntactic sugar and that means less typing
and better readability.
On the other hand, if I have the choice to define either a
function/procedure or a macro, most often I prefer to write a function
(macros are no first-class values, the debugger does not see them...).
However, I may finally define some convenient macros for the very top
level which simply calls the function but reduces some typing.
One of the particular dangers of macros is this: if you write an
abstraction for something for which you only have a macro requires the
abstraction again to be a macro, at least for more complex cases. This
is often undesirable. For example, at present one can not write a
function in Oz which creates a class and implicitly defines specific
methods for the class which depend on arguments given to the function.
One could do this in a macro. Alternatively, we could extend Class.new
in such a way that one can write this abstraction as a function.
(Of course, extending Class.new is the only option as long as we don't
have any macros in Oz ;-)
Thanks!
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