On 9/18/07, skaller <[EMAIL PROTECTED]> wrote:
> > What if we did that? Can we parse X (a=5, b=6)? I think C# and java
> > are adding that syntax.
>
> I don't know .. only one way to find out... :)
>
> More precisely, can we parse:
>
>         (a=1, b=2) // anonymous struct = record
>
> Then we could allow X(1,2) to be written X(a=1,b=2), if the compiler
> just generates a record->struct constructor as well as the existing
> tuple->struct constructor.

Now that would be useful. We might need a prefix to those values
though, so then we could use this in function declarations. This may
help to distinguish between a function taking a tuple and a function
taking an anonymous struct. We could copy ocaml and use '~', or
lisp/ruby and use ':', or just use a period since that's already an
operator. Then we'd have:

fun foo (a:int, b:string, c:float) = { ... }
fun foo1 (~a:int, ~b:string, ~c:float) = { ... }
fun foo2 (:a:int, :b:string, :c:float) = { ... }
fun foo3 (.a:int, .b:string, .c:float) = { ... }

The tildes are probably the easiest to read and notice.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to