Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #1044

Re: Immediate definitions

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: Immediate definitions
Newsgroups comp.lang.forth
References <inkj3u$enh$1@dont-email.me>
Message-ID <fNSdnZAMJIn2eADQnZ2dnUVZ_rmdnZ2d@supernews.com> (permalink)
Date 2011-04-07 11:25 -0500

Show all headers | View raw


Gerry Jackson <gerry@jackson9000.fsnet.co.uk> wrote:
> I've just hit a portability problem to do with immediate VALUEs in that 
> two respected ANS Forth systems don't seem to work correctly.
> 
> Does the ANS Forth standard permit such definitions as
> 123 constant x immediate
> variable y immediate
> 123 value v immediate

As far as I can see, yes.

> However the answer to RFI 7 waffles on leaving me confused and the 
> definition of 'definition' talks about Forth execution procedures (which 
> sound like colon definitions to me). The question has been asked before 
> on comp.lang.forth without a clear answer. Also the Hayes core test 
> program doesn't test these - but it doesn't test everything anyway.

The answer to that question doesn't affect the question you're asking
here, as far as I can see.

> To see what happens in practice I tested six different Forths - GForth, 
> Win32 Forth, VFX Forth (4.21), SwiftForth, iForth and BigForth - with 
> these simple tests
> 
> 123 constant x immediate
> : z x [ . ] ;
> z
> 
> All Forths display 123 as I would expect.
> 
> variable x immediate 123 x !
> : z x [ @ . ] ;
> z
> 
> All except iForth display 123, iForth gives an access violation.
> 
> 123 value x immediate
> : z x [ . ] ;
> z
> 
> Four Forths display 123, VFX Forth and iForth both give a stack 
> underflow leaving z undefined.

That's just a bug, I think.  VALUEs don't have any special permision
to be weird.

Andrew.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Immediate definitions Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2011-04-07 15:52 +0100
  Re: Immediate definitions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-04-07 15:54 +0000
  Re: Immediate definitions Andrew Haley <andrew29@littlepinkcloud.invalid> - 2011-04-07 11:25 -0500
  Re: Immediate definitions StephenPelc <stephen@mpeforth.com> - 2011-04-08 02:11 -0700

csiph-web