Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #14888
| From | Mark Wills <markrobertwills@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Is this example in the Forth200x draft 11.1 correct? |
| Date | 2012-08-09 02:30 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <dfd640ba-679c-4903-b4e5-d512fac77e15@f2g2000vbm.googlegroups.com> (permalink) |
| References | (2 earlier) <jvqlka$79p$1@speranza.aioe.org> <2012Aug7.161823@mips.complang.tuwien.ac.at> <9sudnYJa3YPjS7zNnZ2dnUVZ_qSdnZ2d@supernews.com> <2012Aug8.094212@mips.complang.tuwien.ac.at> <c63e0120-726e-4ed5-9723-530be8704be3@nc9g2000pbc.googlegroups.com> |
On Aug 9, 2:12 am, Hugh Aguilar <hughaguila...@yahoo.com> wrote:
> On Aug 8, 12:42 am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
> wrote:
>
> > Elizabeth D Rather <erat...@forth.com> writes:
> > Maybe. I know a standard way that does not have that fundamental
> > inefficiency and produces faster, but bigger constants. But that way
> > is not presented in most Forth texts. Why not?
>
> > How would you define CONSTANT in standard Forth?
>
> Here is an ANS-Forth compliant way to write CONSTANT using the novice
> package:
>
> : <constant> { value name -- }
> name get-current :name \ runtime: -- value
> value lit, ;,
> ;
>
> : constant ( -- )
> bl word hstr dup >r <constant> r> dealloc ;
>
> I could have made the constant word immediate, and had it be STATE
> smart --- it would do the LIT, when it is run to put a literal into
> the colon definition. This would be more efficient on SwiftForth that
> doesn't do any optimization. For example:
>
> 5 constant hhh ok
> see hhh
> 4802BF 4 # EBP SUB 83ED04
> 4802C2 EBX 0 [EBP] MOV 895D00
> 4802C5 5 # EBX MOV BB05000000
> 4802CA RET C3 ok
>
> : test hhh . ; ok
> test 5 ok
> see test
> 4802FF 4802BF ( hhh ) CALL E8BBFFFFFF
> 480304 4093EF ( . ) JMP E9E690F8FF ok
>
> Instead of a CALL to HHH, we would have a literal value of 5 inside of
> TEST. An optimizing compiler should be able to inline HHH though, so
> this isn't really necessary.
>
> Mostly the reason why I didn't make the constant an immediate word
> that is STATE smart, is because it may happen that the programmer
> ticks it.
I'm going to have to take a good luck at this novice package (I've
looked before, but only quickly). There's some good stuff in it. I
think you should rename it. Don't call it a novice package. Call it a
toolkit. How about FTK "Forth toolkit"?
What I like about the FTK is it's extra words for building words at
runtime.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is this example in the Forth200x draft 11.1 correct? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-03 16:23 -0400
Is this example in the Forth200x draft 11.1 correct? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-03 13:49 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-03 23:07 +0200
Re: Is this example in the Forth200x draft 11.1 correct? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-03 18:28 -0400
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-04 02:49 +0200
Re: Is this example in the Forth200x draft 11.1 correct? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-04 04:33 -0400
Re: Is this example in the Forth200x draft 11.1 correct? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-04 04:37 -0500
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-06 21:27 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Howerd <howerdo@yahoo.co.uk> - 2012-08-07 00:04 -0700
Re: Is this example in the Forth200x draft 11.1 correct? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-07 05:05 -0400
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-07 14:18 +0000
Re: Is this example in the Forth200x draft 11.1 correct? Alex McDonald <blog@rivadpm.com> - 2012-08-07 09:39 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-07 20:20 +0200
Re: Is this example in the Forth200x draft 11.1 correct? Alex McDonald <blog@rivadpm.com> - 2012-08-07 12:31 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Alex McDonald <blog@rivadpm.com> - 2012-08-07 13:26 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-08 00:49 +0200
Re: Is this example in the Forth200x draft 11.1 correct? Alex McDonald <blog@rivadpm.com> - 2012-08-07 12:33 -0700
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-08 07:21 +0000
Re: Is this example in the Forth200x draft 11.1 correct? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-08 01:12 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-08 19:11 +0200
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-07 19:29 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Elizabeth D Rather <erather@forth.com> - 2012-08-07 22:01 -0500
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-07 20:07 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Elizabeth D Rather <erather@forth.com> - 2012-08-07 23:03 -0500
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-08 07:42 +0000
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-08 18:12 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-08 18:59 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-09 02:30 -0700
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-09 09:48 +0000
Re: Is this example in the Forth200x draft 11.1 correct? Percy <percival.andrews@gmail.com> - 2012-08-10 06:33 -0700
Re: Is this example in the Forth200x draft 11.1 correct? "David N. Williams" <williams@umich.edu> - 2012-08-10 09:58 -0400
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-10 15:39 +0000
Re: Is this example in the Forth200x draft 11.1 correct? "David N. Williams" <williams@umich.edu> - 2012-08-10 16:15 -0400
Re: Is this example in the Forth200x draft 11.1 correct? percival.andrews@gmail.com - 2012-08-10 16:42 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Coos Haak <chforth@hccnet.nl> - 2012-08-11 01:51 +0200
Re: Is this example in the Forth200x draft 11.1 correct? George Hubert <georgeahubert@yahoo.co.uk> - 2012-08-11 06:25 -0700
Re: Is this example in the Forth200x draft 11.1 correct? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-11 09:12 +0000
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-13 14:28 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-14 00:51 +0200
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-13 16:24 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-14 03:25 +0200
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-14 07:54 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Bernd Paysan <bernd.paysan@gmx.de> - 2012-08-14 23:22 +0200
Re: Is this example in the Forth200x draft 11.1 correct? hughaguilar96@yahoo.com - 2012-08-16 00:37 -0700
Re: Is this example in the Forth200x draft 11.1 correct? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-08-07 19:30 -0700
csiph-web