ForthHub/discussion

-ROT not in 2012 Standard

Closed this issue · 4 comments

Budsy commented

I was puzzled to see that -ROT is not in the 2012 Forth core word list. Ok, I know that ROT ROT would be the equivalent, and 2 ROLL would do the same thing. But, gosh, I have been using -ROT from various Forths for a long time, and use it a lot. If it were part of a standard Forth, it could be optimized in ML, for example. So, arguments for not relying on the inline code:

: -ROT ( n1 n2 n3 -- n3 n2 n1 ) ROT ROT ; \ a pity to have to use this. slower
: -ROT ( n1 n2 n3 -- n3 n2 n1) 2 ROLL ; \ sobbing now... have to push a value on stack, slower

Thoughts?

Budsy commented

Yes, I do that sort of thing in my code-- conditionally compiling -- but I might be having to do this all the time for what 'feels' like it should be a standard primitive. Acttually, -ROT is in my system (SwiftForth), so it's more of an academic argument for me at this point.