bugGforth - Bugs: bug #63038, CONST-DOES> curry example fails

 
 

bug #63038: CONST-DOES> curry example fails

Submitter:  Stephan Rudlof <hartrock>
Submitted:  Fri 09 Sep 2022 01:28:14 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  anton
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 11 Sep 2022 11:19:52 PM UTC, comment #6: 

Thanks for fixing and explanations!

BTW (some nitpicking): version stays at
  Gforth 0.7.9_20220901
.

Stephan Rudlof <hartrock>
Sun 11 Sep 2022 09:09:16 PM UTC, comment #5: 

Decompilation of 3+ works now, thanks mostly to Bernd Paysan.


see 3+
: 3+  #3 <curry++$58>
  ; ok


Note that the word called by 3+ is nameless and therefore decompiled as an address.

Decompiling r@ as i is normal.  They are two names for the same word.

Anton Ertl <anton>
Group administrator
Fri 09 Sep 2022 12:36:17 PM UTC, comment #4: 

Update:
comment #3:

> Additional problem with this fix (code working, though):


> : ttt >r r@ r> ;  ok
> see ttt
> : ttt
>   >r i r> ; ok

This behavior seems to be normal, since it also arises with older gforth versions (probably an index 'i' is just stored by '>r').

But problem with 'see 3+' (see below) stays.

Stephan Rudlof <hartrock>
Fri 09 Sep 2022 12:25:56 PM UTC, comment #3: 

Additional problem with this fix (code working, though):

: ttt >r r@ r> ;  ok
see ttt
: ttt
  >r i r> ; ok


Stephan Rudlof <hartrock>
Fri 09 Sep 2022 11:48:42 AM UTC, comment #2: 

Fix working :-)

But the '+' in code of 3+ is not visible by 'see 3+' (simple '4+' for comparison):

sr@rs:~/Gforth$ cat t_curry.fs
: curry+ ( n1 "name" -- )
1 0 CONST-DOES> ( n2 -- n1+n2 )
    + ;

3 curry+ 3+

: 4+ #4 + ;

see 3+
see 4+

cr
3 3+ .
4 4+ .
cr
sr@rs:~/Gforth$ gforth t_curry.fs

: 3+  #3

  ;
: 4+
  #4 + ;
6 8
Gforth 0.7.9_20220901
Authors: Anton Ertl, Bernd Paysan, Jens Wilke et al., for more type `authors'
...


Stephan Rudlof <hartrock>
Fri 09 Sep 2022 11:24:58 AM UTC, comment #1: 

Thanks.  Fixed with commit 590b5ac0958b28d7569829e3b6168010155a3a6c

Anton Ertl <anton>
Group administrator
Fri 09 Sep 2022 01:28:14 AM UTC, original submission:  

Example from
  Const-does> (Gforth Manual)
  https://gforth.org/manual/Const_002ddoes_003e.html
fails:

sr@rs:~/Gforth$ cat t_curry.fs
: curry+ ( n1 "name" -- )
1 0 CONST-DOES> ( n2 -- n1+n2 )
    + ;

3 curry+ 3+
sr@rs:~/Gforth$ gforth t_curry.fs

in file included from *the terminal*:0:-94807120602943:
in file included from *the terminal*:-1:1:
t_curry.fs:5:10: error: Stack underflow
3 curry+ >>>3+<<<
Backtrace:
/usr/local/share/gforth/0.7.9_20220901/stuff.fs:90:2:  0 $7F4126569AE0 swap
/usr/local/share/gforth/0.7.9_20220901/stuff.fs:90:13:  1 $7F4126569B00 compile-literals
                                         2 $3
/usr/local/share/gforth/0.7.9_20220901/stuff.fs:106:29:  3 $7F4126569C78 compile-literals
t_curry.fs:2:5:                          4 $7F41265C20F8 (const-does>)
sr@rs:~/Gforth$ gforth --version
gforth 0.7.9_20220901 amd64


Stephan Rudlof <hartrock>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anton (Posted a comment)
  • -email is unavailable- added by hartrock (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-09 anton StatusNone Fixed
        Assigned toNone anton
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code