The reason the with-... combinators are typically inline is that they can be used in different situations with different stack effects. If you want to make the stack effects static, something like this could work:
: with-ctrl-break ( lines quot: ( lines -- quot ) -- quot ) enable-ctrl-break '[ _ _ call( x -- x ) ] [ disable-ctrl-break ] [ ] cleanup ; : with-no-ctrl-break ( lines quot: ( lines -- quot ) -- quot ) call( x -- x ) ; On Tue, Aug 23, 2016 at 4:57 PM, Alexander Ilin <ajs...@yandex.ru> wrote: > 24.08.2016, 02:17, "John Benediktsson" <mrj...@gmail.com>: > > You are right that you can't `call` a dynamic quotation but you can `get > call( -- )` it just fine. The issue is knowing the implied stack effect of > the quotation being called. If you provide it then the caller will get the > value of the symbol and check the desired stack effect matches before > calling it. > > > > I think your last version is wrong because the parse-lines-interactive > seems to no longer return a quotation? > > Yes, that's the problem. In one instance `with-ctrl-break` calls a > quotation that takes and returns nothing, and in another instance the > quotation should consume something and return something. If we `inline` the > `with-ctrl-break`, then we're good for both cases, but if we use `SYMBOL > get call`, then there is no single stack effect to check on the call, that > would work for both cases. > > So straight concatenative-style cut-and-replace `with-ctrl-break` for > `SYMBOL get call` can't be done, am I right? > > The with-... combinators can work when they are inlined, which allows > them to sink roots into the stack of the surrounding code, but they can't > be easily relocated to a new place without ripping the roots. I wonder if > we could ever have any with- combinators without the `inline` attribute. > > ---=====--- > Александр > > ------------------------------------------------------------ > ------------------ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk >
------------------------------------------------------------------------------
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk