Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #39516
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Field name overloading (was: ColorForth - another dead end?) |
| Date | 2015-06-02 09:47 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2015Jun2.114719@mips.complang.tuwien.ac.at> (permalink) |
| References | (5 earlier) <mkbvcb$en0$1@dont-email.me> <ebfc8bdf-0f90-49b7-8469-b52bcae527e3@googlegroups.com> <77c3499b-2f89-41ec-b477-f529b7c2345b@googlegroups.com> <2015Jun1.152134@mips.complang.tuwien.ac.at> <c097cfc0-7763-469b-b2ac-8cb9489da270@googlegroups.com> |
humptydumpty <ouatubi@gmail.com> writes:
>in '+field' version 'see 2testY' shows:
>: 2testY
> Ob Y ? ;
>
>in my struct version 'see 2testY' shows:
>: 2testY
> Ob 8 + ? ;
And SEE Y shows
: Y
8 + ; ok
The behaviour is the same, but admittedly the run-time is slower on
Forth systems that don't inline automatically.
>and also show independence of 'Base' content.
Yes, I took a closer look at your STRUCT and the usage patterns, and
found that you have integrated a workaround for the BASE problem. An
alternative would be to use a number prefix to make the string BASE
independent.
What is still missing is a workaround that guarantees that the right
"+" will be found. Counterexample for the current implementation:
struct POS
cell field X
cell field Y
end-struct
: + cr ." funny +" cr ;
CREATE Ob POS SIZEOF allot
Ob POS Y .s
After fixing this the result is certainly an interesting solution to
the field (and method?) name overloading resulution problem in the
context of the current standard (you would need to get rid of some
Gforthisms, but that should be possible). The interesting part is in
STRUCT and would work also with the +FIELD I defined (but, as seen
above, there is a difference in inlining).
That problem has led to defining words for STATE-smart words in Bernd
Paysan's OOF and AFAIK other programs. Other proposed solutions to
the problem go outside the standard: preludes and the dot-parser (the
latter implemented with recognizers). I think it's cleaner than a
STATE-smart approach.
What you cannot do with it directly is ticking and postponing POS Y,
but you can define
: pos-y POS Y ;
and tick or postpone that. However, why not just define POS-Y without
overloading right from the start? Always writing POS Y instead of
POS-Y is not an advantage.
One possible advantage is in the context of inheritance: If you have a
class A with field X and class B and C inherit field X from A, you
don't want to refer to the field with A-X (because that would make
reorganizing the class hierarchy hard); referring to the field with
A X or B X or C X would be possible with a variation of your
technique, and would restrict class reorganizations only as necessary.
- 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.mpeforth.com/euroforth2015/euroforth2015.htm
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ColorForth - another dead end? borota@gmail.com - 2015-05-24 12:22 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-24 14:00 -0700
Re: ColorForth - another dead end? borota@gmail.com - 2015-05-24 16:18 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-24 16:45 -0700
Re: ColorForth - another dead end? "Elizabeth D. Rather" <erather@forth.com> - 2015-05-24 14:50 -1000
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-24 18:12 -0700
Re: ColorForth - another dead end? onewhohopes@gmail.com - 2015-05-28 13:00 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-28 18:55 -0700
Re: ColorForth - another dead end? Howerd <howerdo@yahoo.co.uk> - 2015-05-29 00:49 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-29 07:56 -0700
Re: ColorForth - another dead end? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 15:04 +0000
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-29 10:03 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-29 10:15 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-29 19:28 -0700
Re: ColorForth - another dead end? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-30 12:34 +0000
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-29 19:19 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-29 22:30 -0700
Re: ColorForth - another dead end? "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-30 00:14 -0400
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-29 22:22 -0700
Re: ColorForth - another dead end? "Alex McDonald" <blog@rivadpm.com> - 2015-05-30 09:27 +0100
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-30 02:05 -0700
Re: ColorForth - another dead end? "Alex McDonald" <blog@rivadpm.com> - 2015-05-30 10:21 +0100
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-30 04:08 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-30 07:43 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-30 09:42 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-30 10:25 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-30 22:36 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-31 16:38 -0700
Re: ColorForth - another dead end? "Alex McDonald" <blog@rivadpm.com> - 2015-05-31 09:11 +0100
Re: ColorForth - another dead end? humptydumpty <ouatubi@gmail.com> - 2015-05-31 11:31 -0700
Re: ColorForth - another dead end? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-01 13:21 +0000
Re: ColorForth - another dead end? humptydumpty <ouatubi@gmail.com> - 2015-06-01 08:18 -0700
Re: ColorForth - another dead end? humptydumpty <ouatubi@gmail.com> - 2015-06-01 09:07 -0700
Re: ColorForth - another dead end? humptydumpty <ouatubi@gmail.com> - 2015-06-01 23:31 -0700
Field name overloading (was: ColorForth - another dead end?) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-02 09:47 +0000
Re: Field name overloading (was: ColorForth - another dead end?) humptydumpty <ouatubi@gmail.com> - 2015-06-02 13:07 -0700
Re: ColorForth - another dead end? humptydumpty <ouatubi@gmail.com> - 2015-06-01 08:20 -0700
Re: ColorForth - another dead end? "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-30 15:34 -0400
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-29 22:55 -0700
Re: ColorForth - another dead end? Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-30 00:54 -0700
Re: ColorForth - another dead end? stephen@mpeforth.com (Stephen Pelc) - 2015-05-30 17:20 +0000
Re: ColorForth - another dead end? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-05-31 15:17 +0000
Re: ColorForth - another dead end? Hannu Vuolasaho <vuokkosetae@gmail.com> - 2015-05-25 10:06 +0300
Re: ColorForth - another dead end? Jason Damisch <jasondamisch@yahoo.com> - 2015-05-25 11:11 -0700
Re: ColorForth - another dead end? rickman <gnuarm@gmail.com> - 2015-05-25 14:22 -0400
Re: ColorForth - another dead end? "Elizabeth D. Rather" <erather@forth.com> - 2015-05-25 14:57 -1000
Re: ColorForth - another dead end? borota@gmail.com - 2015-05-25 20:42 -0700
Re: ColorForth - another dead end? hughaguilar96@gmail.com - 2015-05-29 19:46 -0700
Re: ColorForth - another dead end? "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-30 00:03 -0400
Re: ColorForth - another dead end? Howerd <howerdo@yahoo.co.uk> - 2015-05-24 21:51 -0700
Re: ColorForth - another dead end? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-05-25 11:17 +0000
Re: ColorForth - another dead end? Mark Wills <markwills1970@gmail.com> - 2015-05-25 01:50 -0700
Re: ColorForth - another dead end? Howerd <howerdo@yahoo.co.uk> - 2015-05-25 02:11 -0700
Re: ColorForth - another dead end? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-25 14:11 +0000
csiph-web