I've being experimenting with operators in the Io language. Everything works fine in the cli, but as soon as I put my code in files instead, I run into problems.
Here's a tiny example (creating an operator +++ that does the same thing as +)
OperatorTable addOperator("+++", 3) # Say that +++ should be an operator
Number +++ := method(v, call target + v) # Define the slot +++ on numbers
(30 +++ 40) println # Try it out!
As mentioned, this works fine in the cli, but doesn't work when I try to run it in a file. I presume it has something to do with the fact that file has been preparsed, before the operator is defined, but how would I work around that?
This is a limitation of the operator shuffler in Io. What happens is roughly this:
Unfortunately for you, you're manipulating the operator shuffler after it's already run.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With