Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #30546
| From | Gerry Jackson <gerry@jackson9000.fsnet.co.uk> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: One for Elizabeth... |
| Date | 2014-05-21 23:32 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <llj9gs$5id$1@dont-email.me> (permalink) |
| References | (15 earlier) <7x7g5wz3ld.fsf@ruckus.brouhaha.com> <453bebff-d3ed-43bd-a7fe-21244a98e5d5@googlegroups.com> <53991bb7-91d9-4148-8c18-6573bb47f093@googlegroups.com> <lkrde7$g15$1@dont-email.me> <f983a79b-b505-4e71-a658-bc677cd3522f@googlegroups.com> |
On 14/05/2014 06:37, hughaguilar96@yahoo.com wrote: > On Monday, May 12, 2014 2:11:35 PM UTC-7, Gerry wrote: >> On 10/05/2014 04:25, hughaguilar96@yahoo.com wrote: >>> Quotations can't be done in ANS-Forth, or Forth-200x as it currently stands.. This really has to be done at the language-design level. > >> If that's the case please explain why Knuth's Man or Boy works in ANS >> Forth, see Stephen Pelc in >> https://groups.google.com/forum/?hl=en#!msg/comp.lang.forth/x8hUOj1MetU/tSHs6EMudLEJ > > In that thread, Pelc said: > On Friday, July 20, 2012 4:12:21 AM UTC-7, Stephen Pelc wrote: >> There is a Forth example by Gerry Jackson which provides an >> example of lambda definitions. This example is in ANS Forth and >> runs on a range of systems. >> www.qlikz.org/forth/lambda.zip > > The link provided doesn't work, so I couldn't download the code and examine it. Are you the "Gerry Jackson" that he mentions? Can you make the code available again? > I've emailed you a copy of the code, let me know if you haven't received it. > What I said was true --- ANS-Forth doesn't provide any way for the quotation to access the locals in the creator function --- all that can be done in ANS-Forth is Payson-faked quotations that are just syntactic sugar for :NONAME. > > I'm guessing that in your code your "local variables" are actually fields in a struct that is on the heap and you pass the pointer to the struct around with the xt of the closure, and also pass it into the closure as a parameter. That's more or less correct. It works by scanning the source code twice, once to identify where enclosed definitions start and end. The second time jumping around compiling inner definitions first and working outwards. > My working definitions are that a closure has the local variables on the heap, and a quotation has the local variables on a locals' stack (usually the return stack). This technique is routinely done in C, and it can be done in ANS-Forth too. You are not going to have syntax for your struct-based locals that is at all comparable to normal syntax for locals. This technique is incredibly ugly in C, and it would be in ANS-Forth too --- this is just a clunky work-around that is done in languages that lack quotations (in 2014, this is mostly just old-school languages such as C and ANS-Forth, as most of the modern languages have either quotations or closures). I never claimed it was pretty or efficient, you said it couldn't be done at all, the fact it runs Knuth's Man or Boy test proves otherwise. > > I have said at least a dozen times that I don't want closures and I consider them to be a bad idea. For one thing, they are an order of magnitude slower than stack-based locals; such gross inefficiency is going to limit Forth to being a toy-language and preclude it from ever being used in application programming. Closures are for scripting languages in which speed is not a concern (most or all scripting languages are also dynamic-OOP, which is another speed killer). The only advantage of closures over quotations is that the closure can outlive the creator function. As I have said though, this is a solution to a non-problem, as there is no point in doing this, and :NONAME already does this anyway. > > If your code is good, I can put it in the novice package. I doubt that you'll think it's good enough. I intended it as just proof it could be done and was a package people could load and experiment with. Doing some things in ANS Forth is cumbersome and this code is rather large. [..] -- Gerry
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-02 20:31 -0700
Re: One for Elizabeth... stephenXXX@mpeforth.com (Stephen Pelc) - 2014-05-03 08:26 +0000
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-03 19:33 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-04 03:35 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-04 11:06 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-05 01:11 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-05 20:45 -0700
Re: One for Elizabeth... Rob Sciuk <rob@controlq.com> - 2014-05-06 12:53 -0400
Re: One for Elizabeth... Assad Ebrahim <assad.ebrahim@alum.swarthmore.edu> - 2014-05-07 09:59 +0100
Re: One for Elizabeth... rickman <gnuarm@gmail.com> - 2014-05-07 12:12 -0400
Re: One for Elizabeth... Coos Haak <chforth@hccnet.nl> - 2014-05-08 02:05 +0200
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-10 23:01 -0700
Re: One for Elizabeth... Paul Rubin <no.email@nospam.invalid> - 2014-05-05 20:58 -0700
Re: One for Elizabeth... AKK <akk@nospam.org> - 2014-05-06 07:16 +0200
Re: One for Elizabeth... "Elizabeth D. Rather" <erather@forth.com> - 2014-05-05 20:52 -1000
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-06 01:17 -0700
Re: One for Elizabeth... "Alex McDonald" <blog@rivadpm.com> - 2014-05-06 11:13 +0100
Re: One for Elizabeth... "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-05-06 07:12 -0400
Re: One for Elizabeth... Alex McDonald <blog@rivadpm.com> - 2014-05-06 10:57 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-06 17:06 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-06 07:52 -0700
Re: One for Elizabeth... Melzzzzz <mel@zzzzz.com> - 2014-05-06 17:11 +0200
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-06 08:57 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-07 00:38 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-07 22:56 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-08 04:10 -0700
Re: One for Elizabeth... thomas.worthington@london.ac.uk - 2014-05-08 04:42 -0700
Re: One for Elizabeth... rickman <gnuarm@gmail.com> - 2014-05-08 11:17 -0400
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-07 00:31 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-07 00:23 -0700
Re: One for Elizabeth... Paul Rubin <no.email@nospam.invalid> - 2014-05-07 02:29 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-07 13:39 -0700
Re: One for Elizabeth... Paul Rubin <no.email@nospam.invalid> - 2014-05-08 01:26 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-08 04:11 -0700
Re: One for Elizabeth... Paul Rubin <no.email@nospam.invalid> - 2014-05-08 08:34 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-08 11:04 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-08 17:28 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-09 02:55 -0700
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-09 10:42 -0700
Re: One for Elizabeth... Paul Rubin <no.email@nospam.invalid> - 2014-05-09 19:59 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-09 20:25 -0700
Re: One for Elizabeth... Laurent Laborde <kerdezixe@gmail.com> - 2014-05-11 05:24 -0700
Re: One for Elizabeth... Julian Fondren <ayrnieu@gmail.com> - 2014-05-12 22:08 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-12 22:11 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-13 22:37 -0700
Re: One for Elizabeth... "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-05-14 04:09 -0400
Re: One for Elizabeth... Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2014-05-14 04:44 -0700
Re: One for Elizabeth... Mark Wills <markwills1970@gmail.com> - 2014-05-14 05:05 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-14 20:53 -0700
Re: One for Elizabeth... rickman <gnuarm@gmail.com> - 2014-05-15 01:08 -0400
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-18 22:23 -0700
Re: One for Elizabeth... Whammo <sidciavic@gmail.com> - 2014-05-19 09:48 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-21 19:50 -0700
Re: One for Elizabeth... "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-05-22 00:46 -0400
Re: One for Elizabeth... "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-05-19 22:37 -0400
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-21 23:58 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-21 19:24 -0700
Re: One for Elizabeth... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-22 11:05 +0000
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-22 23:19 -0700
Re: One for Elizabeth... albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-23 11:34 +0000
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-26 11:44 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-27 14:20 +0100
Re: One for Elizabeth... rickman <gnuarm@gmail.com> - 2014-05-27 10:30 -0400
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-27 19:58 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-28 07:45 +0100
Re: One for Elizabeth... Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-05-28 03:03 -0500
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-28 16:36 -0700
Re: One for Elizabeth... rickman <gnuarm@gmail.com> - 2014-05-28 23:03 -0400
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-29 11:01 -0700
Re: One for Elizabeth... anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-05-30 16:44 +0000
Re: One for Elizabeth... "Elizabeth D. Rather" <erather@forth.com> - 2014-05-29 08:25 -1000
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-21 23:32 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-26 11:15 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-27 19:42 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-27 20:23 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-28 09:14 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-28 16:25 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-29 20:47 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-29 20:28 -0700
Re: One for Elizabeth... Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2014-05-30 22:24 +0100
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-30 21:49 -0700
Re: One for Elizabeth... Bernd Paysan <bernd.paysan@gmx.de> - 2014-05-29 23:40 +0200
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-29 19:47 -0700
Re: One for Elizabeth... Paul E Bennett <Paul_E.Bennett@topmail.co.uk> - 2014-05-08 14:36 +0100
Re: One for Elizabeth... visualforth@rocketmail.com - 2014-05-08 10:46 -0700
Re: One for Elizabeth... hughaguilar96@yahoo.com - 2014-05-07 22:24 -0700
Re: One for Elizabeth... Rob Sciuk <rob@controlq.com> - 2014-05-04 13:46 -0400
csiph-web