What if I would introduce classes ? I'd probably have to get rid of maps. Because what would be the added value of maps? None as far as I can see.
I could then also introduce the idea that everything is a class. Currently, if you have a primitive and you assign a function to a member of it, then the original variable turns from a primitive into a map.
a = 3; a.f = function(x,y){ return x+y; }However, if everything were a class, then the function assignment would just extend the class of the primitive. Or would it ?
How does that work in java ? Primitives can both have value and methods.
That also raises the question of the 'this' object. Make 'this' a reserved word ? Or 'self' ?
Inheritance is out of the question for now. I'm thinking of introducing a 'clone' operator (something like '<=='). Then you can use the clone of an object to extend it further.
c = class { def a,b,c; def new = function(){ c.a = 0; c.b = 0; c.c = 0; } } d <== c; d.sum = function(){ return d.a + d.b + d.c; }Looks like we're not really having classes here, but only instantiations, or objects. That's OK. It also looks like we do not need a 'this' thing.
Geen opmerkingen:
Een reactie posten