Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #13990
| Newsgroups | comp.lang.forth |
|---|---|
| From | Albert van der Horst <albert@spenarnc.xs4all.nl> |
| Subject | Is smartness the problem? |
| Date | 2012-07-14 12:22 +0000 |
| Message-ID | <m75h1o.ide@spenarnc.xs4all.nl> (permalink) |
| Organization | Dutch Forth Workshop |
Recently we had a discussion about formatting. The basic idea is: AVAILABLE "HOST" GET-ENV "The computer %s has %d bytes available" FORMAT&TYPE What FORMAT&TYPE does is 1. split at the % , collect first part 2. identify a word e.g. s , use it as a formatter 3. EXECUTE s , which gives a string, collect that string 4. repeat at step 1 until format string exhausted 5. TYPE the string thus collected Similarly we have FORMAT&EVAL We make a wordlist with formatters s and d. Alternative implementations are now 1. once you find the string "s" or "d" evaluate it with the formatters at the top of the search order. 2. Use SEARCH-WORD-LIST and EXECUTE I've been bitten hard by a problem caused by using 1 and the existance of STATE. There is no smart word in sight, but it smells the same. I want to add the phrase " ^%s @ %d +" to a method definition, where at %s the name of the class is to be filled in and at %d the offset of the field where the method is supposed to work. The string e.g. "^VECTOR @ 4 + " has to be evaluated in compilation mode. However I got the string "^ @ +". It took me some time to realize that evaluating "s" in compilation mode, merely added s to the current definition, and did nothing to end up in the collected string. So, I wonder what wise lessons concerning STATE I missed to get into this trouble. (I solve this by method 2 and using a lightweight SEARCH-WORDLIST . My two screen mini-objects is now a one screen mini-objects plus a one screen formatter, which is independantly useful. An alternative is stacking STATE and switching to execution mode. ) Groetjes Albert -- -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar
Is smartness the problem? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-14 12:22 +0000 Re: Is smartness the problem? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-07-14 11:53 +0000 Re: Is smartness the problem? Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-14 15:26 +0200
csiph-web