Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #55985
| From | "HAA" <someone@microsoft.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: When to use !name vs. name! ? |
| Date | 2017-03-21 12:10 +1100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <oapudj$icj$1@gioia.aioe.org> (permalink) |
| References | (1 earlier) <oafbg5$o8g$1@dont-email.me><rr6dnZECzYMUDFbFnZ2dnUU7-dnNnZ2d@supernews.com><oahp1s$341$1@gioia.aioe.org><vJidnaF6x-728VHFnZ2dnUU7-KvNnZ2d@supernews.com> <oahrln$jg2$1@dont-email.me><oakgpo$mjn$1@gioia.aioe.org> <oakpjr$lf6$1@dont-email.me> <oan19q$12u3$1@gioia.aioe.org> <170lq1srs0rqt$.p4ckv826gjru.dlg@40tude.net> |
Coos Haak wrote: > Op Mon, 20 Mar 2017 09:41:11 +1100 schreef HAA: > > > rickman wrote: > >> On 3/18/2017 7:47 PM, HAA wrote: > >>> rickman wrote: > >>>> On 3/17/2017 7:08 PM, Elizabeth D. Rather wrote: > >>>>> ... > >>>>> It depends on the word. Words that simply fetch a value from a variable > >>>>> aren't substantive enough to justify separates @/! definitions, so it > >>>>> really depends on what the rest of the action is. I can imagine an > >>>>> application that uses a thermocouple, for example. The name of the port > >>>>> that controls it is Thermo. I would have words like !Thermo to write to > >>>>> it and @Thermo to read it and maybe perform a calibration. I would > >>>>> prefer to have the symbol first in these cases because it's the action > >>>>> that's important, not the thing being acted upon. > >>>> > >>>> So reverse the method used across Forth because the action is important? > >>>> Is it really not important what it is acting on? I think it is the > >>>> opposite. The noun should be first since that is the important part. > >>>> The verb is last because it only has meaning in the context of what it > >>>> is acting on. > >>>> ... > >>> > >>> There are numerous cases where the action comes first and the object the > >>> qualification e.g. open/close-file read/write-line get/set-order, begin/end-xxx. > >>> In this context @/!name becomes shortform for get/set restore/save etc. > >>> Where the action is trivial e.g. peek/poke memory then the object takes > >>> precedence and reflects the stack order. e.g. name@/! . Being a trivial > >>> operation however, there may be little need for defining a such a function. > >> > >> But the fetch and store operations have an operator @ and !. Usage is > >> <name> @ or <name> !. Combining these words into one operator the > >> convention would be name@ or name!. I've seen this guideline explicitly > >> stated for cases like 1+ or 2* and many others. > > > > If it is advantageous for trivial functions to have names indicative of the stack > > effect - is it not also advantageous to differentiate functions that are not simple > > or indicative? Forth has GET-ORDER SET-ORDER not ORDER@ ORDER! > > because ORDER is a concept, not a memory location. > > Forths with the SEARCH WORDLIST have GET-ORDER and SET-ORDER > They deliver or store a structure consisting of wid's and a number. > I have seen implementations that had ORDER@ and ORDER! > Those were synonyms of (FigForth) CONTEXT @ and CONTEXT ! respectively. CONTEXT was a simple variable where a trailing @/! operator was appropriate. GET/SET-ORDER reflects a more complex function where the emphasis is on the action, not the object. > Another example. I have a pointer that gives its value by saying > MYPTR and setting to another value by >MYPTR . > The first is used more often, so writing of MYPTR> is distracting. > > groet Coos The opposite of >MYPTR would typically be named <MYPTR. Relevant here is how the action (to/from) precedes the object.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-14 11:15 +1100
Re: When to use !name vs. name! ? hughaguilar96@gmail.com - 2017-03-13 18:27 -0700
Re: When to use !name vs. name! ? Mark Wills <markwills1970@gmail.com> - 2017-03-14 01:33 -0700
Re: When to use !name vs. name! ? Mark Wills <markwills1970@gmail.com> - 2017-03-14 01:30 -0700
When to use !name vs. name! ? NN <november.nihal@gmail.com> - 2017-03-14 02:56 -0700
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-16 08:59 +1100
Re: When to use !name vs. name! ? Mark Wills <markwills1970@gmail.com> - 2017-03-16 02:11 -0700
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-17 11:19 +1100
Re: When to use !name vs. name! ? rickman <gnuarm@gmail.com> - 2017-03-16 20:46 -0400
Re: When to use !name vs. name! ? "Elizabeth D. Rather" <erather@forth.com> - 2017-03-16 21:34 -1000
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-18 09:49 +1100
Re: When to use !name vs. name! ? "Elizabeth D. Rather" <erather@forth.com> - 2017-03-17 13:08 -1000
Re: When to use !name vs. name! ? rickman <gnuarm@gmail.com> - 2017-03-17 19:35 -0400
Re: When to use !name vs. name! ? Mark Wills <markwills1970@gmail.com> - 2017-03-18 00:51 -0700
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-19 10:47 +1100
Re: When to use !name vs. name! ? rickman <gnuarm@gmail.com> - 2017-03-18 22:18 -0400
Re: When to use !name vs. name! ? "Elizabeth D. Rather" <erather@forth.com> - 2017-03-18 16:36 -1000
Re: When to use !name vs. name! ? rickman <gnuarm@gmail.com> - 2017-03-18 23:53 -0400
Re: When to use !name vs. name! ? "Elizabeth D. Rather" <erather@forth.com> - 2017-03-18 22:22 -1000
Re: When to use !name vs. name! ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-19 16:03 +0000
Re: When to use !name vs. name! ? Alex <alex@rivadpm.com> - 2017-03-19 17:42 +0000
Re: When to use !name vs. name! ? "Elizabeth D. Rather" <erather@forth.com> - 2017-03-19 13:10 -1000
Re: When to use !name vs. name! ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-03-19 13:34 +0100
Re: When to use !name vs. name! ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-03-19 16:23 +0000
Re: When to use !name vs. name! ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-03-19 20:47 +0100
Re: When to use !name vs. name! ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-03-20 03:47 -0500
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-20 09:41 +1100
Re: When to use !name vs. name! ? Coos Haak <htrofhc@gmail.com> - 2017-03-20 01:24 +0100
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-21 12:10 +1100
Re: When to use !name vs. name! ? hughaguilar96@gmail.com - 2017-03-20 18:45 -0700
Re: When to use !name vs. name! ? Coos Haak <htrofhc@gmail.com> - 2017-03-21 14:58 +0100
Re: When to use !name vs. name! ? "HAA" <someone@microsoft.com> - 2017-03-22 19:49 +1100
Re: When to use !name vs. name! ? hughaguilar96@gmail.com - 2017-03-17 16:46 -0700
Re: When to use !name vs. name! ? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-04-12 08:13 +0200
csiph-web