Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42598
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: [Poll] Computing favorities |
| Date | 2015-10-12 09:14 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2015Oct12.111408@mips.complang.tuwien.ac.at> (permalink) |
| References | (5 earlier) <ei7j1bt0g8l2c001c282lvecvahekchmld@4ax.com> <ed805464-efae-4aad-870c-430f1204594c@googlegroups.com> <e32e1aa8-f97b-4428-a1c1-89e331f59755@googlegroups.com> <e78152bc-0487-4441-a978-971707e8ce86@googlegroups.com> <1239853a-dd63-4549-87c5-980268aa64d3@googlegroups.com> |
Mark Wills <markwills1970@gmail.com> writes:
>The other thing is, I wouldn't have made it so
>that locals are initialised from the stack. You don't always want=20
>that; sometimes your local will want to be initialised from the=20
>result of a call to a word. Of course, you can do that with 200x
>locals, however, you'd need to supply a dummy 0 on the stack to=20
>initialise the local variable. That adds confusion and is superfluous
>imo. It's a minor niggle however.
>
>In my system locals are not initialised from the data stack at
>all. They're just initialised to 0. You use SET to load them with
>values:
>
>: do-a-thing ( -- )
> locals{ tom dick harry }
> do-this set tom
> do-that set dick
> do-the-other set harry=20
> tom dick harry or or if okay else tilt then ;
Simpler to program in Gforth:
: do-a-thing ( -- )
do-this { tom }
do-that { dick }
do-the-other { harry }
tom dick harry or or if okay else tilt then ;
If you want to be Forth-2012 compliant, You can do it your way with
slightly different syntax:
: do-a-thing ( -- )
{: | tom dick harry :}
do-this to tom
do-that to dick
do-the-other to harry
tom dick harry or or if okay else tilt then ;
Also, you might want to choose an example where avoiding locals would
result in a lot of stack juggling, unlike here:
: do-a-thing ( -- )
do-this do-that do-the-other or or if okay else tilt then ;
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2015: http://www.rigwit.co.uk/EuroForth2015/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [Poll] Computing favorities Roberto Waltman <usenet@rwaltman.com> - 2015-10-10 19:28 -0400
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-11 01:27 -0700
Re: [Poll] Computing favorities franck.bensusan@gmail.com - 2015-10-11 07:24 -0700
Re: [Poll] Computing favorities hughaguilar96@gmail.com - 2015-10-11 16:31 -0700
Re: [Poll] Computing favorities Mark Wills <markwills1970@gmail.com> - 2015-10-12 01:55 -0700
Re: [Poll] Computing favorities anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-10-12 09:14 +0000
Re: [Poll] Computing favorities Howerd <howerdo@yahoo.co.uk> - 2015-10-12 01:04 -0700
Re: [Poll] Computing favorities "WJ" <w_a_x_man@yahoo.com> - 2015-10-12 09:20 +0000
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-12 12:34 -0700
Re: [Poll] Computing favorities hughaguilar96@gmail.com - 2015-10-12 17:07 -0700
Re: [Poll] Computing favorities rickman <gnuarm@gmail.com> - 2015-10-12 21:20 -0400
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-13 13:05 -0700
Re: [Poll] Computing favorities lehs <skydda.barnen@gmail.com> - 2015-10-13 13:08 -0700
csiph-web