Currently all constructors require that all structure members be explicitly
initialized. While this is fine for trivial cases, it will not suffice for
general purpose use.
Add support for a constructor tag that flags an overloaded function as being a
constructor, i.e. that creates a bound local variable in the appropriate scope.
This should be trivial to accomplish by hooking the existing compile-time
helper and tagging mechanisms.
Syntax should resemble the following:
structure Foo :
(
integer(NumericField),
string(TextField),
boolean(FlagField)
)
Foo : (identifier(variablename)) -> (Foo(0, "default", false))
[constructor(variablename)]
entrypoint : () -> ()
{
// Construct the "normal" explicit way
Foo(normal, 42, "test", true)
// ... and now construct using the overloaded constructor defined above
Foo(usesdefaults)
debugwritestring(normal.TextField) // outputs "test"
debugwritestring(usesdefaults.TextField) // outputs "default"
}
Original issue reported on code.google.com by don.ap...@gmail.com on 20 Dec 2010 at 6:40
Original issue reported on code.google.com by
don.ap...@gmail.com
on 20 Dec 2010 at 6:40