I'm working in the operator implementation for types using it like a
common method call. This will make the thing easier to come with an
operator overloading in user-level. And this is just like as did in
the TODO language.
I've created the branch in my repo:
https://github.com/felipensp/clever/tree/operator
In this ways, we won't need a opcode handler for each binary
expression. I.e. 'x + y' will yields a method call to 'x' type's
method '$+$'. Hence, we will use the argument types to check if a
determined type accepts operation with another type, as in actual
method call.
x + y => (type* of x)->$+$(x, y)
From an optimization view (constant propagation), it's not affected,
we can do it without problem yet.
@Murilo
I guess we don't need a separated Operator map, It's more cleaner if
we just use the method stuff. So I changed a bit the idea.
Thoughts?
--
Regards,
Felipe Pena
Hi guys,
I'm working in the operator implementation for types using it like a
common method call. This will make the thing easier to come with an
operator overloading in user-level. And this is just like as did in
the TODO language.
I've created the branch in my repo:
https://github.com/felipensp/clever/tree/operator
In this ways, we won't need a opcode handler for each binary
expression. I.e. 'x + y' will yields a method call to 'x' type's
method '$+$'. Hence, we will use the argument types to check if a
determined type accepts operation with another type, as in actual
method call.
x + y => (type* of x)->$+$(x, y)
From an optimization view (constant propagation), it's not affected,
we can do it without problem yet.
@Murilo
I guess we don't need a separated Operator map, It's more cleaner if
we just use the method stuff. So I changed a bit the idea.
Thoughts?
--
Regards,
Felipe Pena