DreamBerd
DreamBerd copied to clipboard
Add operator overloading
Many modern programming languages have operator overloading, so DreamBerd ought to have it too. In fact, users should be given the freedom to make any operator they want.
It's lacking the specification of operator operator.
I think this has legs! The "twist" of being able to define all operators is fun. Could also do it with the , operator for arrays.
I wonder if there's a way of coming up with some simpler examples so that we don't have to put a "...". That would make it more fun I think :)
What about operator ...() => { print("hello world")! }?
Ohhh... maybe too advanced, but imagine
You may have noticed that the examples above use ... to represent the body of each function. This isn't pseudo-code. Instead, ... is an operator that we've defined later on.
operator ...<-Infinity>() => {
return ... // Function body goes here
}
I like the idea of defining ... itself as an operator. Perhaps instead of the implementation being recursive (return ...), it should use DreamBerd's AI feature to implement whatever the original function wanted? Maybe something like
postfix operator !(foo) => {
return ... // Factorial
}
unfix operator ...<-Infinity>() => {
const const code = email("Lu Wilson", "Subject: give me teh codez", getOuterFunction())!
exec(code)!
}
Yeah you could place ... at the very end of the file(s) so that it reliably triggers AI
assigning this to myself to remind me to review at some point