We don't support ocaml's "with" construct with our records yet, do we?
For those unfamiliar with this, it would be something like this in
pseudo-felix:

val x = struct { a = 5; b = 6; };
val y = struct { x with a = 1; };  // equals struct { a = 1; b = 6; }


This can help a little with emulating keyword arguments to a function,
with something ugly like this:

val foo_keywords = struct { a = 5; b = 6; };
proc foo (s:struct { a: int; b: int }) { ... }
foo (struct { foo_keywords with a = 1; });


It's not great though because there's still quite a bit of repetition.
I wonder if we could add a bit of sugar to this pattern to do this for
us automatically. I guess it would be something like this:

proc foo1 (s:struct { a: int; b = 5; }) { ... }
foo1 (struct { a = 1; });

proc foo2 (s:struct { a = 4; b = 5; }) { ... }
foo2 (struct {});


Where the struct we pass in is automatically converted to use "with"
expansion. Would this violate the whole "no automatic conversions"
rule?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to