jeff-jenness / close

Automatically exported from code.google.com/p/close
0 stars 0 forks source link

Add support for typed literals #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It should be possible to put typed literals in line in Close code:
{{{
pmc a = {1, 1, 2, 3, 5, 8};
pmc foo = ResizableStringArray: { "foo", "bar" };
}}}

If a user-specified type is given, the correct construction is to create a
new object and then call a series of setters on it:

{{{
pmc foo = Klass: { a: 1, b: 2};

# Becomes...

pmc temp = Klass.new();
temp.a(1);
temp.b(2);
pmc foo = temp;
}}}

Because if the class could accept a hash/array constructor, the user could
code:
{{{
pmc foo = Klass.new( { a: 1, b: 2 } );
}}}
And the default-hash literal constructor would work fairly well.

Original issue reported on code.google.com by austin_h...@yahoo.com on 8 Jul 2009 at 10:15