> So the retain stack is useless? Freeing up a whole register sounds > like it should be great for performance, at least on 32 bit x86.
You can make a complete stack-based concatenative language with only one stack. But some combinators are implemented more efficiently when you have scratch space to use. Here are some pseudocode reductions. You can implement “dip” as “swap quote cat apply”: 1 2 3 [ + ] dip 1 2 3 [ + ] swap quote cat apply 1 2 [ + ] 3 quote cat apply 1 2 [ + ] [ 3 ] cat apply 1 2 [ + 3 ] apply 3 3 Or you can implement it as “swap retain apply restore”: 1 2 3 [ + ] dip 1 2 3 [ + ] swap retain apply restore 1 2 [ + ] 3 retain apply restore 1 2 [ + ] apply restore 3 restore 3 3 In the former case, you had to allocate a quotation and concatenate two quotations. These can of course be optimised out, but a retain stack has a more efficient naïve operational semantics, and having a “spare” stack for temporary use makes some code a lot nicer without needing to go as far as introducing local variables. ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Factor-talk mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/factor-talk
