Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #13018 > unrolled thread
| Started by | Albert van der Horst <albert@spenarnc.xs4all.nl> |
|---|---|
| First post | 2012-06-15 20:40 +0000 |
| Last post | 2012-06-22 15:43 -0700 |
| Articles | 16 on this page of 96 — 13 participants |
Back to article view | Back to comp.lang.forth
?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-15 20:40 +0000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-16 11:14 +1000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-16 07:10 -0700
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-17 03:01 +0000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-17 13:36 +1000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-17 12:27 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-17 20:45 +0000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-18 13:31 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-18 18:29 +0000
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-18 08:01 -1000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-19 14:09 +0000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-19 10:51 -0500
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-19 16:04 +0000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-19 12:45 -0500
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-20 10:50 +0000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-20 07:10 -0500
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-20 12:47 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-19 22:52 +0000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-20 10:59 +0000
Defining Compilation Behaviour - was Re: ?EXEC JennyB <jennybrien@googlemail.com> - 2012-06-21 04:58 -0700
Re: Defining Compilation Behaviour - was Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-21 15:44 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-19 02:11 +0200
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-18 14:45 -1000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-19 10:48 +0000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-19 15:53 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-19 23:00 +0000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-20 11:09 +0000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-20 07:39 -0700
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-20 15:32 +0000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-21 11:24 -0700
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-20 22:43 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-21 21:39 +0200
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-22 02:33 -0500
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-22 11:12 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-22 21:34 +0200
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-24 14:58 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-24 23:53 +0200
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-19 15:43 +0000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-19 14:52 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-21 22:15 +0200
Re: ?EXEC stephenXXX@mpeforth.com (Stephen Pelc) - 2012-06-22 10:32 +0000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-22 05:49 -0500
Alternatives to S" and TO (was: ?EXEC) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-22 15:19 +0000
Re: Alternatives to S'' and TO mhx@iae.nl (Marcel Hendrix) - 2012-06-22 20:37 +0200
Re: Alternatives to S'' and TO anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-23 14:46 +0000
Re: Alternatives to S" and TO (was: ?EXEC) BruceMcF <agila61@netscape.net> - 2012-06-22 12:32 -0700
Re: Alternatives to S" and TO Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-23 03:07 -0500
Re: Alternatives to S" and TO anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-23 13:32 +0000
Re: Alternatives to S" and TO Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-24 08:50 -0500
Re: Alternatives to S" and TO anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-24 15:39 +0000
Re: Alternatives to S" and TO Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-25 04:49 -0500
Re: Alternatives to S" and TO BruceMcF <agila61@netscape.net> - 2012-06-25 07:17 -0700
Re: Alternatives to S" and TO Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-25 10:13 -0500
Re: Alternatives to S" and TO (was: ?EXEC) Alex McDonald <blog@rivadpm.com> - 2012-06-23 16:01 -0700
Re: Alternatives to S" and TO (was: ?EXEC) Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-24 01:59 +0200
Re: Alternatives to S" and TO (was: ?EXEC) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-24 13:21 +0000
Re: Alternatives to S" and TO (was: ?EXEC) Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-24 16:50 +0000
Re: Alternatives to S" and TO (was: ?EXEC) Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-27 23:30 +0200
Re: Alternatives to S" and TO (was: ?EXEC) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-24 13:15 +0000
Re: Alternatives to S" and TO (was: ?EXEC) Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-24 16:47 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-22 20:34 +0000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-22 21:46 +0200
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-22 10:16 -1000
Re: ?EXEC Bernd Paysan <bernd.paysan@gmx.de> - 2012-06-22 22:43 +0200
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-22 11:18 -1000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-23 13:50 +0000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-17 10:41 -0700
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-17 12:52 +0000
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-17 08:03 -1000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-18 15:06 +1000
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-17 20:31 -1000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-21 13:07 +1000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-21 14:00 +0000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-21 07:51 -0700
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-21 15:39 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-21 20:28 +0000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-28 14:22 +1000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-28 04:00 -0500
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-21 16:09 +0000
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-21 11:51 -0500
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-21 11:21 -0700
Re: ?EXEC Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-06-22 01:42 -0500
Re: ?EXEC "Elizabeth D. Rather" <erather@forth.com> - 2012-06-21 21:47 -1000
Re: ?EXEC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-06-22 15:10 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-22 20:39 +0000
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-22 12:47 -0700
Re: ?EXEC BruceMcF <agila61@netscape.net> - 2012-06-22 12:53 -0700
Re: ?EXEC stephenXXX@mpeforth.com (Stephen Pelc) - 2012-06-21 08:39 +0000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-23 15:36 +1000
Re: ?EXEC stephenXXX@mpeforth.com (Stephen Pelc) - 2012-06-23 10:58 +0000
Re: ?EXEC "Ed" <invalid@nospam.com> - 2012-06-25 14:26 +1000
Re: ?EXEC stephenXXX@mpeforth.com (Stephen Pelc) - 2012-06-25 08:37 +0000
Re: ?EXEC Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-06-18 10:34 +0000
Re: ?EXEC Coos Haak <chforth@hccnet.nl> - 2012-06-18 17:47 +0200
Re: ?EXEC Coos Haak <chforth@hccnet.nl> - 2012-06-18 17:49 +0200
Re: ?EXEC jacko <jackokring@gmail.com> - 2012-06-22 15:43 -0700
Page 5 of 5 — ← Prev page 1 2 3 4 [5]
| From | BruceMcF <agila61@netscape.net> |
|---|---|
| Date | 2012-06-21 11:21 -0700 |
| Message-ID | <6220e5e4-91a1-4e00-9b62-883a0fe53e08@e7g2000pbg.googlegroups.com> |
| In reply to | #13134 |
On Jun 21, 12:51 pm, Andrew Haley <andre...@littlepinkcloud.invalid> wrote: > The default in Forth is that given > > : z ( -) foo bar baz ; > > you expect that Z calls FOO, BAR, then BAZ . You may be wrong, but > it's a good first guess. The principle of least surprise says that > you want to match, as far as possible, the readers' experience, > expectations, and mental models. From this one can directly derive > the principle that one should minimize the number of IMMEDIATE words. This also suggests that naming immediate words to highlight their distinctiveness is good practice, as with [CHAR] [IF] [ELSE] [THEN] etc, and as might have been done with [TO] to avoid the functional overloading of TO.
[toc] | [prev] | [next] | [standalone]
| From | Andrew Haley <andrew29@littlepinkcloud.invalid> |
|---|---|
| Date | 2012-06-22 01:42 -0500 |
| Message-ID | <NJmdnfbvK-BvjnnSnZ2dnUVZ8q-dnZ2d@supernews.com> |
| In reply to | #13136 |
BruceMcF <agila61@netscape.net> wrote: > On Jun 21, 12:51?pm, Andrew Haley <andre...@littlepinkcloud.invalid> > wrote: > >> The default in Forth is that given >> >> : z ? ( -) foo bar baz ; >> >> you expect that Z calls FOO, BAR, then BAZ . You may be wrong, but >> it's a good first guess. The principle of least surprise says that >> you want to match, as far as possible, the readers' experience, >> expectations, and mental models. From this one can directly derive >> the principle that one should minimize the number of IMMEDIATE words. > > This also suggests that naming immediate words to highlight their > distinctiveness is good practice, as with [CHAR] [IF] [ELSE] [THEN] > etc, and as might have been done with [TO] to avoid the functional > overloading of TO. Or make them a different colour. However, I think that naming all immediate words like that would make Forth harder to read. It's always a compromise, I suppose. TO and S" seem to be perpetually problematic. Andrew.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2012-06-21 21:47 -1000 |
| Message-ID | <kqGdnRh8Mtq7vnnSnZ2dnUVZ_uKdnZ2d@supernews.com> |
| In reply to | #13151 |
On 6/21/12 8:42 PM, Andrew Haley wrote: > BruceMcF<agila61@netscape.net> wrote: ... >> This also suggests that naming immediate words to highlight their >> distinctiveness is good practice, as with [CHAR] [IF] [ELSE] [THEN] >> etc, and as might have been done with [TO] to avoid the functional >> overloading of TO. > > Or make them a different colour. However, I think that naming all > immediate words like that would make Forth harder to read. It's > always a compromise, I suppose. The naming convention [...] is conflicted. For [CHAR] and ['] it identifies a compile-only version of a normally interpretive word. For [IF], [ELSE], and [THEN] it suggests an interpretive version of a normally compile-only word. Bottom line: it means, "check your documentation." But they're now "common usage," so IMO any remedy is worse than the disease at this point. We just have to be careful going forward. > TO and S" seem to be perpetually problematic. Yes. Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Date | 2012-06-22 15:10 +0000 |
| Message-ID | <2012Jun22.171001@mips.complang.tuwien.ac.at> |
| In reply to | #13153 |
"Elizabeth D. Rather" <erather@forth.com> writes:
>The naming convention [...] is conflicted. For [CHAR] and ['] it
>identifies a compile-only version of a normally interpretive word. For
>[IF], [ELSE], and [THEN] it suggests an interpretive version of a
>normally compile-only word.
Yes, you can use [IF] interpretively, but you can also use it inside
colon definitions for conditional compilation. It's a bit cumbersome,
because you then have to provide a value on the stack at compile time,
but Forth200x has [DEFINED] and [UNDEFINED] to the rescue.
: foo
... [DEFINED] bar [IF] 5 bar [ELSE] ... replacement code ... [THEN] ... ;
In that context the brackets make sense.
- 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 2012: http://www.euroforth.org/ef12/
[toc] | [prev] | [next] | [standalone]
| From | Albert van der Horst <albert@spenarnc.xs4all.nl> |
|---|---|
| Date | 2012-06-22 20:39 +0000 |
| Message-ID | <m61ddb.51u@spenarnc.xs4all.nl> |
| In reply to | #13164 |
In article <2012Jun22.171001@mips.complang.tuwien.ac.at>, Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote: >"Elizabeth D. Rather" <erather@forth.com> writes: >>The naming convention [...] is conflicted. For [CHAR] and ['] it >>identifies a compile-only version of a normally interpretive word. For >>[IF], [ELSE], and [THEN] it suggests an interpretive version of a >>normally compile-only word. > >Yes, you can use [IF] interpretively, but you can also use it inside >colon definitions for conditional compilation. It's a bit cumbersome, >because you then have to provide a value on the stack at compile time, >but Forth200x has [DEFINED] and [UNDEFINED] to the rescue. > >: foo > ... [DEFINED] bar [IF] 5 bar [ELSE] ... replacement code ... [THEN] ... ; > >In that context the brackets make sense. Having interpreted IF I have looked whether it made [IF] superfluous, and concluded that it does a poor job for conditional compilation: global @ IF : aap onething ; ELSE : aap otherthing ; THEN just doesn't work. So one really needs [IF] . > >- anton 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
[toc] | [prev] | [next] | [standalone]
| From | BruceMcF <agila61@netscape.net> |
|---|---|
| Date | 2012-06-22 12:47 -0700 |
| Message-ID | <aa6ecd35-69f0-4a72-a48a-109960b0fc07@j25g2000yqn.googlegroups.com> |
| In reply to | #13153 |
On Jun 22, 3:47 am, "Elizabeth D. Rather" <erat...@forth.com> wrote: > On 6/21/12 8:42 PM, Andrew Haley wrote: > > > BruceMcF<agil...@netscape.net> wrote: > ... > >> This also suggests that naming immediate words to highlight their > >> distinctiveness is good practice, as with [CHAR] [IF] [ELSE] [THEN] > >> etc, and as might have been done with [TO] to avoid the functional > >> overloading of TO. > > > Or make them a different colour. However, I think that naming all > > immediate words like that would make Forth harder to read. It's > > always a compromise, I suppose. > > The naming convention [...] is conflicted. For [CHAR] and ['] it > identifies a compile-only version of a normally interpretive word. For > [IF], [ELSE], and [THEN] it suggests an interpretive version of a > normally compile-only word. Bottom line: it means, "check your > documentation." CHAR when compiling finds the character at run-time, [CHAR] when compiling finds the character when compiling. IF when compiling finds the flag on the data stack at run-time, [IF] when compiling finds the flag on the data stack when compiling. I do not see the conflict. That's why implementation dependency constants are immediate, eg: 1 CHARS 1 = CONSTANT [char=au] IMMEDIATE 0 TEST ! TRUE TEST C! TEST C@ 255 = CONSTANT [char=byte] IMMEDIATE
[toc] | [prev] | [next] | [standalone]
| From | BruceMcF <agila61@netscape.net> |
|---|---|
| Date | 2012-06-22 12:53 -0700 |
| Message-ID | <c9c8edfd-a751-40af-a037-5f9e3e26a453@b1g2000vbb.googlegroups.com> |
| In reply to | #13151 |
On Jun 22, 2:42 am, Andrew Haley <andre...@littlepinkcloud.invalid> wrote: > Or make them a different colour. However, I think that naming all > immediate words like that would make Forth harder to read. It's > always a compromise, I suppose. Well, [(] [)] would be going overboard. > TO and S" seem to be perpetually problematic. Defining a standard alternate name for buffered-S" would be handy. Among the multiple problems with the mistake in overloading the name for the compiled S" and the buffered S" is that it makes compiling the buffered S" into a definition more intricate than it ought to be.
[toc] | [prev] | [next] | [standalone]
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Date | 2012-06-21 08:39 +0000 |
| Message-ID | <4fe2dd5c.83692087@192.168.0.50> |
| In reply to | #13042 |
On Mon, 18 Jun 2012 15:06:47 +1000, "Ed" <invalid@nospam.com> wrote: >VFX is loaded with ?COMPs. Not any more. It was a while ago. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
[toc] | [prev] | [next] | [standalone]
| From | "Ed" <invalid@nospam.com> |
|---|---|
| Date | 2012-06-23 15:36 +1000 |
| Message-ID | <js3kld$fu7$1@speranza.aioe.org> |
| In reply to | #13125 |
Stephen Pelc wrote: > On Mon, 18 Jun 2012 15:06:47 +1000, "Ed" <invalid@nospam.com> wrote: > > >VFX is loaded with ?COMPs. > > Not any more. It was a while ago. For various reasons I can only run the older demos. So what do you now use in place of ?COMP ?EXEC etc (if anything). Does VFX still warn if an attempt is made to use conditionals IF THEN etc interpretively?
[toc] | [prev] | [next] | [standalone]
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Date | 2012-06-23 10:58 +0000 |
| Message-ID | <4fe59ebe.45562525@192.168.0.50> |
| In reply to | #13190 |
On Sat, 23 Jun 2012 15:36:50 +1000, "Ed" <invalid@nospam.com> wrote: >So what do you now use in place of ?COMP ?EXEC etc >(if anything). Does VFX still warn if an attempt is made to >use conditionals IF THEN etc interpretively? We allow the compilation behaviour to be defined separately from the interpretation behaviour. dis if IF ( 00409E20 E86FF5FFFF ) CALL 00409394 NOINTERP ( 00409E25 C3 ) NEXT, ( 6 bytes, 2 instructions ) ok IF has a separate compilation behaviour. This allows all the structure words to be non-IMMEDIATE. The problem that this approach solves is that IMMEDIATE specifies that the interpretation and compilation actions are the same. In this case, in order to differentiate, e.g. when compiling native code, one has to be STATE smart, which is a "bad thing". This approach also makes it very easy to have both interpreted and compiled behaviours in S" and friends. Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
[toc] | [prev] | [next] | [standalone]
| From | "Ed" <invalid@nospam.com> |
|---|---|
| Date | 2012-06-25 14:26 +1000 |
| Message-ID | <js8p9q$ou6$1@speranza.aioe.org> |
| In reply to | #13194 |
Stephen Pelc wrote: > On Sat, 23 Jun 2012 15:36:50 +1000, "Ed" <invalid@nospam.com> wrote: > > >So what do you now use in place of ?COMP ?EXEC etc > >(if anything). Does VFX still warn if an attempt is made to > >use conditionals IF THEN etc interpretively? > > We allow the compilation behaviour to be defined separately > from the interpretation behaviour. > > dis if > IF > ( 00409E20 E86FF5FFFF ) CALL 00409394 NOINTERP > ( 00409E25 C3 ) NEXT, > ( 6 bytes, 2 instructions ) > ok > > IF has a separate compilation behaviour. This allows all the > structure words to be non-IMMEDIATE. The problem that this approach > solves is that IMMEDIATE specifies that the interpretation and > compilation actions are the same. In this case, in order to > differentiate, e.g. when compiling native code, one has to be > STATE smart, which is a "bad thing". > > This approach also makes it very easy to have both interpreted > and compiled behaviours in S" and friends. Thanks. I take it from your disassembly that executing IF BEGIN DO etc interpretively in VFX still results in an error and abort.
[toc] | [prev] | [next] | [standalone]
| From | stephenXXX@mpeforth.com (Stephen Pelc) |
|---|---|
| Date | 2012-06-25 08:37 +0000 |
| Message-ID | <4fe8234b.210567419@192.168.0.50> |
| In reply to | #13232 |
On Mon, 25 Jun 2012 14:26:30 +1000, "Ed" <invalid@nospam.com> wrote: >Thanks. I take it from your disassembly that executing IF BEGIN >DO etc interpretively in VFX still results in an error and abort. Yes Stephen -- Stephen Pelc, stephenXXX@mpeforth.com MicroProcessor Engineering Ltd - More Real, Less Time 133 Hill Lane, Southampton SO15 5AF, England tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691 web: http://www.mpeforth.com - free VFX Forth downloads
[toc] | [prev] | [next] | [standalone]
| From | Albert van der Horst <albert@spenarnc.xs4all.nl> |
|---|---|
| Date | 2012-06-18 10:34 +0000 |
| Message-ID | <m5t6pn.4ml@spenarnc.xs4all.nl> |
| In reply to | #13038 |
In article <VqCdnXuTWa6dgUPSnZ2dnUVZ_smdnZ2d@supernews.com>,
Elizabeth D. Rather <erather@forth.com> wrote:
>On 6/17/12 2:52 AM, Anton Ertl wrote:
>> Albert van der Horst<albert@spenarnc.xs4all.nl> writes:
>>> I find places where ?EXEC is used. This gives an error because a word
>>> if a word is executed while it never should.
>>>
>>> Examples are CODE and END-CODE in an assembler, but does this make
>>> sense?
>>>
>>> : CODE ?EXEC .... ;
>>> : END-CODE ?EXEC .... ;
>>
>> Hardly. It makes a little more sense if CODE and END-CODE are
>> immediate. I guess the idea is to protect the porgrammer against
>>
>> : foo
>> ... \ missing ";"
>>
>> code bar
>> ...
>>
>> And of course in fig-Forth also ":" was immediate and contained a
>> ?EXEC.
>
>Baffled. By what logic should CODE, END-CODE, and : be immediate?
>
>...
>> Overall, ?EXEC is a bad idea, like ?COMP and STATE-smart words in
>> general.
>
>Agreed. All of these fall in the category of cute tricks that you *can*
>do in Forth, but are really a poor idea in serious production code.
>Newbies in Forth like to explore "uncharted waters". That's ok, but it's
>not how serious code is written.
After the explanation of Anton Ertl I finally see how ?EXEC
could be -- marginally -- useful.
: test dothis dothat
X SWAP IF
qqq
THEN
DROP ;
: test2 ....
In this situation if you change the last line of test to
DROP
you will have `` : test2 '' compiled and this gives an
error of test2 not found/ Mysterious, but you learn to interpret
that message.
By making : IMMEDIATE it can signal this condition.
CODE aap ... \ END-CODE
CODE noot ... END-CODE
Same situation.
?COMP saves me from the following hazard:
_ _ \ #scores, #sides
class C
M: sides M; ,
M: maxscores M; DUP ,
M: scores SWAP CELLS + M;
HERE DUP >R OVER CELLS ALLOT R> SWAP CELLS ERASE
endclass
This defines a class with an integer field and an array of
integers field that is initialised to zero.
The building of the structure amounts to
: BUILD-C HERE >R , DUP ,
HERE DUP >R OVER CELLS ALLOT R> SWAP CELLS ERASE
;
This is compiled, but also interpreted immediately to
calculate the offsets.
I tend to forget that the following doesn't work:
_ _
class C
M: sides M; ,
M: scores SWAP CELLS + M;
0 DO 0 , LOOP
endclass
and it leads to mysterious errors.
If DO warned at compile time that would have been prevented.
Loading an interpreting DO facility is a solution.
>
>Cheers,
>Elizabeth
>
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
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2012-06-18 17:47 +0200 |
| Message-ID | <1uzarilpcnqmx.1uhv13layzvl5$.dlg@40tude.net> |
| In reply to | #13018 |
Op 15 Jun 2012 20:40:13 GMT schreef Albert van der Horst: > I find places where ?EXEC is used. This gives an error because a word > if a word is executed while it never should. > > Examples are CODE and END-CODE in an assembler, but does this make > sense? > >: CODE ?EXEC .... ; >: END-CODE ?EXEC .... ; > > By analogy I see I defined my classes like this: >: class ?EXEC ... ; >: end-class ?EXEC ... ; > > I find it hard to wrap my head around this. In what kind of situation > would this error trigger? > I would be equally happy with some other realistic example. > > Groetjes Albert > > > -- I've looked at the Forth assemblers in volume 3 of Forth Dimensions. William F. Ragdale's for the 6502 in issue 5 has immediate CODE END-CODE and even for IF, ELSE, BEGIN, etc. and uses ?EXEC John J. Cassady's for the 8080 in issue 6 has only CODE and END-CODE made immediate with ?EXEC I don't use immediate words in assembler and just removed ?EXEC from the MetaForth. I sense no difference. -- Coos CHForth, 16 bit DOS applications http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2012-06-18 17:49 +0200 |
| Message-ID | <1oomr5uvzgh5g.w7n9ycjcblq0.dlg@40tude.net> |
| In reply to | #13046 |
Op Mon, 18 Jun 2012 17:47:07 +0200 schreef Coos Haak: > I've looked at the Forth assemblers in volume 3 of Forth Dimensions. > William F. Ragdale's for the 6502 in issue 5 has immediate CODE END-CODE > and even for IF, ELSE, BEGIN, etc. and uses ?EXEC > John J. Cassady's for the 8080 in issue 6 has only CODE and END-CODE made > immediate with ?EXEC immediate and uses ?EXEC > > I don't use immediate words in assembler and just removed ?EXEC from the > MetaForth. I sense no difference. -- Coos CHForth, 16 bit DOS applications http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [next] | [standalone]
| From | jacko <jackokring@gmail.com> |
|---|---|
| Date | 2012-06-22 15:43 -0700 |
| Message-ID | <a5337f91-b34a-40a6-b915-fe39d6841618@googlegroups.com> |
| In reply to | #13018 |
? Implies if. Nop implies exec without ?. Why test? ... To test before the jump, and to ignore the jumpd result... Maybe I'm drunk, maybe I'm just a cycle analyst.... On Friday, 15 June 2012 21:40:13 UTC+1, Albert van der Horst wrote: > I find places where ?EXEC is used. This gives an error because a word > if a word is executed while it never should. > > Examples are CODE and END-CODE in an assembler, but does this make > sense? > > : CODE ?EXEC .... ; > : END-CODE ?EXEC .... ; > > By analogy I see I defined my classes like this: > : class ?EXEC ... ; > : end-class ?EXEC ... ; > > I find it hard to wrap my head around this. In what kind of situation > would this error trigger? > I would be equally happy with some other realistic example. > > 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 On Friday, 15 June 2012 21:40:13 UTC+1, Albert van der Horst wrote: > I find places where ?EXEC is used. This gives an error because a word > if a word is executed while it never should. > > Examples are CODE and END-CODE in an assembler, but does this make > sense? > > : CODE ?EXEC .... ; > : END-CODE ?EXEC .... ; > > By analogy I see I defined my classes like this: > : class ?EXEC ... ; > : end-class ?EXEC ... ; > > I find it hard to wrap my head around this. In what kind of situation > would this error trigger? > I would be equally happy with some other realistic example. > > 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
[toc] | [prev] | [standalone]
Page 5 of 5 — ← Prev page 1 2 3 4 [5]
Back to top | Article view | comp.lang.forth
csiph-web