Author: shkaboinka
Posted: 12 Oct 2012 12:54:35 pm (GMT -5)
(Another) Update on all the changes that currently need to be made:
(1) Add the rest of the preprocessor directives to the grammar, and allow namespaces to have type-arguments (name<type>).
(2) Add constructors (and destructors) using "new" and "delete" keywords; change construction syntax from {} to (); allow constructor parameters without types to map directly to the same variables.
(3) Provide very shortened function syntax:
func x():T { return y; } | func x():T = y; | func x() = y; | func x = y;
(4) Allow interfaces to contain default methods and other member variables (may need constructors?); Replace "interface" keyword with "iface".
(5) Remove anonymous members, but allow transparent member access and method-inheritance (where-ever ambiguity does not result).
(7) Allow method-pointers: T.func() ptrToMethOfT.
(8) Allow initializer lists after (or in place of) constructors:
Foo f(constrArgs) { mem1 = x, mem2 = y }; // f.mem1 = ...
(9) Add "typedefs" to define one type based on another (this is necessary for recursive types):
typedef newType equivType; | typedef recur func(int, recur):recur;
(10) Remove the idea of cofuncs having a "receiver type" (which just acts as composition anyway), but allow them to be embedded within structs again, and still to have their own bodies. However, I am considering changing this syntax:
Code:
Posted: 12 Oct 2012 12:54:35 pm (GMT -5)
(Another) Update on all the changes that currently need to be made:
(1) Add the rest of the preprocessor directives to the grammar, and allow namespaces to have type-arguments (name<type>).
(2) Add constructors (and destructors) using "new" and "delete" keywords; change construction syntax from {} to (); allow constructor parameters without types to map directly to the same variables.
(3) Provide very shortened function syntax:
func x():T { return y; } | func x():T = y; | func x() = y; | func x = y;
(4) Allow interfaces to contain default methods and other member variables (may need constructors?); Replace "interface" keyword with "iface".
(5) Remove anonymous members, but allow transparent member access and method-inheritance (where-ever ambiguity does not result).
(7) Allow method-pointers: T.func() ptrToMethOfT.
(8) Allow initializer lists after (or in place of) constructors:
Foo f(constrArgs) { mem1 = x, mem2 = y }; // f.mem1 = ...
(9) Add "typedefs" to define one type based on another (this is necessary for recursive types):
typedef newType equivType; | typedef recur func(int, recur):recur;
(10) Remove the idea of cofuncs having a "receiver type" (which just acts as composition anyway), but allow them to be embedded within structs again, and still to have their own bodies. However, I am considering changing this syntax:
Code:
//Which syntax?
cofunc Foo { int x; } ():int { return x++; } // SHORT: cofunc Foo { int x; } = x++;
cofunc { int x; } Foo():int { return x++; } // SHORT: cofunc { int x; } Foo = x++;