You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nothing implemented yet.
Just leaving it here for further updates and notes.
TBD.
Conversion operators parse.
Started implementing them, the progress is saved on the experimental-operator-overloading branch.
Checklist
In-class syntax, maybe outside of classes too
Syntax parsing
Proper implementation of simple operator overloading (See Implementation idea)
??? Probably template operator overloading
Syntax idea
This is how a method declaration looks right now:
classOoga{fooga(arg: Int32){ret5+1;}}
I suggest this syntax for operators:
classOoga{operator==(arg: Int32){returnarg==1;}}
For a differentation between prefix and postfix I suggest special keywords pre and post (the C++ approach of putting an int parameter is simply weird and misleading):
(The idea of having pre and post operators may be completely ditched)
For conversion operators this syntax has been decided upon:
classOoga{operatorasInt32{return5;}}
Implementation idea
Every operator goes through the same function in ExpressionExecutor.
Each operator generally does some kind of preprocessing first.
I suggest that each operator does it's preprocessing and calls a special function that looks for operator overloads for a type, with the types provided by the caller.
If it fails, it throws a runtime error, if it succeeds, it returns the result of calling that function.
Syntax preview
Nothing yet.
The text was updated successfully, but these errors were encountered:
Status
Nothing implemented yet.
Just leaving it here for further updates and notes.
TBD.
Conversion operators parse.
Started implementing them, the progress is saved on the
experimental-operator-overloading
branch.Checklist
Syntax idea
This is how a method declaration looks right now:
I suggest this syntax for operators:
For a differentation between prefix and postfix I suggest special keywords
pre
andpost
(the C++ approach of putting an int parameter is simply weird and misleading):(The idea of having pre and post operators may be completely ditched)
For conversion operators this syntax has been decided upon:
Implementation idea
Every operator goes through the same function in
ExpressionExecutor
.Each operator generally does some kind of preprocessing first.
I suggest that each operator does it's preprocessing and calls a special function that looks for operator overloads for a type, with the types provided by the caller.
If it fails, it throws a runtime error, if it succeeds, it returns the result of calling that function.
Syntax preview
Nothing yet.
The text was updated successfully, but these errors were encountered: