Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #50096
| From | Bernd Paysan <bernd.paysan@gmx.de> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: CfV: Quotations |
| Date | 2016-08-14 20:52 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <noqlm8$ag1$3@dont-email.me> (permalink) |
| References | <2016Aug10.185227@mips.complang.tuwien.ac.at> <87lh041mjx.fsf@jester.gateway.pace.com> |
Am Wed, 10 Aug 2016 11:55:14 -0700 schrieb Paul Rubin: > I'm sympathetic to the calls for quotations to be able to access (at > least for reading) the parent locals, like C++ lambdas (C++'s version of > quotations) can do. I don't think comparisons with Lisp or Scheme are > that useful, but comparisons to C++ might be worthwhile. C/C++ has no stack the lambda would be able to access. E.g. if you want to count words in a wordlist with TRAVERSE-WORDLIST and quotations, you do : count-wl ( wid -- count ) >r 0 [: ( n nt -- n' flag ) drop 1+ true ;] r> traverse-wordlist ; Now do that in C++, and you need to access an outer local for that. You don't even have a chance to do it that way, because you can't extend the stack effect ( nt -- flag ) in a C++ function. In Forth, you can, and iterators can be written so that they keep their internal state off the data stack when calling the xt passed to them. Forth is not a locals-centric language, it's a stack-centric language. You can use the stack to pass data through quotations used e.g. as iterators. Without the stack, quotations would be much less useful. The problem with nested functions is not only that they are more difficult to implement, it's also that they can't outlive their parent's stack frame lifetime, and quotations which do are part of the use cases. This has been discussed to death already, with Hugh shouting at me for my "fake quotations". They are Forth quotations, not Lisp or C++ lambdas, because in Forth, we have stacks. And locals are an optional feature. -- Bernd Paysan "If you want it done right, you have to do it yourself" net2o ID: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ* http://bernd-paysan.de/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-10 16:52 +0000
Re: CfV: Quotations Matthias Trute <matthias.trute@gmail.com> - 2016-08-10 11:19 -0700
Re: CfV: Quotations Paul Rubin <no.email@nospam.invalid> - 2016-08-10 11:55 -0700
Re: CfV: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-14 20:52 +0000
Re: CfV: Quotations hughaguilar96@gmail.com - 2016-08-14 14:42 -0700
Re: CfV: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-08-14 16:43 -0700
Re: CfV: Quotations Paul Rubin <no.email@nospam.invalid> - 2016-08-15 22:16 -0700
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-16 07:13 +0000
Re: CfV: Quotations Paul Rubin <no.email@nospam.invalid> - 2016-08-18 15:30 -0700
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-19 15:32 +0000
Re: CfV: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-20 20:46 +0000
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-21 09:32 +0000
Re: CfV: Quotations hughaguilar96@gmail.com - 2016-08-21 11:06 -0700
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-24 17:02 +0000
Re: CfV: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-21 22:52 +0000
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-22 13:54 +0000
Re: CfV: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-22 23:19 +0000
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-24 15:54 +0000
Re: CfV: Quotations Bernd Paysan <bernd@net2o.de> - 2016-08-28 00:43 +0000
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-28 09:53 +0000
Re: CfV: Quotations Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-08-28 08:32 -0500
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-28 14:38 +0000
Re: CfV: Quotations mhx@iae.nl - 2016-08-10 12:02 -0700
Re: CfV: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-11 17:25 +0100
Re: CfV: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-08-11 12:48 -0700
Re: CfV: Quotations minforth@arcor.de - 2016-08-16 03:31 -0700
Re: CfV: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-31 15:15 +0100
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-31 15:26 +0000
Re: CfV: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-09-02 22:33 +0100
Re: CfV: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-09-03 06:47 +0000
csiph-web