[EMAIL PROTECTED]

Dear Olivier,

On 08.06.2006, at 10:24, Olivier Tonglet wrote:
My favorite syntax would be the following. Yet, this is no legal Oz
record syntax: a record label can not be a function (yet?).

defun Foo(X Y#42 z:Z#bla)
   [X Y Z]
end

apply Foo(hi z:there) end %% -> [hi 42 there]

you can define your macro like that:
defun  FunName( Args ) end
with Args being a list when calling the macro, as a varying number of arguments is not accepted.
I hope it's what you would like to have ? Maybe I didn't understood ?


 >I would like to have a record instead of a list (see above), because
>that allows for accessing arguments by their position or feature name.

 You can also use records if you like.

 >How would you write a function application example with keyword
 >arguments with your proposal?

I don't see what you mean. Is it passing keywords as arguments to a macro call ? It's sad but you cannot pass keywords to my macro because Args as to be a valid List (or Record).
 I Guess I didnt answered your question with this macro :(
defun FunName( Args ) end

If you want keywords as arguments the number of arguments has to be fixed... (there will be a meta-variable corresponding to each argument in the macro definition, which will become like that :
 fmacro defun FunName(1:Arg1 2:Arg2 3:Arg3) end
 )

Sorry if I misunderstood something. The number of arguments for functions etc is fixed. Therefore, I proposed to wrap all arguments in some data structure (quasi a lambda list) so I can have optional and keyword arguments.

In my first post I proposed a few ways to do so using either a record (where I could use record features to denote my arguments by position or by some feature) or a list (by introducing quasi lambda-list keywords to denote, e.g., keywords for the arguments).

The last proposal then used records in a way which I would find the most convenient. Here, Foo(X Y#42 z:Z#bla) is a record with Foo (a function) as label. This is not allowed in Oz (yet? see http://www.mozart-oz.org/lists/oz-users/4403.html), but perhaps it would already be possible in the macro facility, because at the time the macro does its processing it is not known that Foo is a function...

defun Foo(X Y#42 z:Z#bla)
  [X Y Z]
end

apply Foo(hi z:there) end %% -> [hi 42 there]

Thanks!

Best,
Torsten

--
Torsten Anders
Sonic Arts Research Centre • Queen's University Belfast
Frankstr. 49 • D-50996 Köln
Tel: +49-221-3980750
www.torsten-anders.de
strasheela.sourceforge.net


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

Reply via email to