-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine variables and operators #1
Comments
Looking at the TON's fift: I wonder if this addition would also be helpful:
Introducing another stack element - another stack. Parser will still go over the contents (and obviously parse nested blocks as well), so we never ignore the invalid syntax and / or operators that are missing. Insides of How to implement this is another question, since operators would need to be aware of such addition without requiring us to re-write every each one to include 'isStack()'. Perhaps, as strong type requirement in the set_operator() in addition to the argc. As a possible idea - introduce another stack instead of abusing the existing one with myriads of conditional checks. |
As a POC, the following works:
Counting depth is another issue. Right now stack value has additional counter byte which is added after stack pop an also after the |
upd: with fixed block enumeration and removed restriction on doing
Additional operators should follow - Another interesting thing from classic forth, which is also available in fift: : plus-one 1 + ;
: do-the-thing 1 plus-one + ;
: plus-one 1 - ;
: do-another-thing 1 plus-one + ;
|
Also, allow to use:
&operator
to create function reference (with specific 'callable' internal type). allow to postpone the operator call:$var &some &operator ifn call
(note that
$bla &operator &value ifn
is also theoretically possible, while not making any real sense :)$operator
(?) i.e. deref support. this might store operator object pointer as unsigned. not very useful, as it seems at a first glancenan
andpi
The text was updated successfully, but these errors were encountered: