use a simple counter instead of gensym

cvs
Slava Pestov 2006-01-21 21:16:49 +00:00
parent 2c212f334c
commit 406f7a71d4
6 changed files with 15 additions and 7 deletions

View File

@ -1,3 +1,4 @@
- fix fixnum<< vop on x86 and ppc
- need line and paragraph spacing
- update HTML stream
- help cross-referencing

View File

@ -25,6 +25,8 @@ library, but is useful enough to ship with the Factor distribution.
- contrib/postgresql/ -- PostgreSQL binding (Doug Coleman)
- contrib/random-tester/ -- Random compiler tester (Doug Coleman)
- contrib/space-invaders/ -- Intel 8080-based Space Invaders arcade
machine emulator (Chris Double)

View File

@ -25,6 +25,9 @@ sequences strings vectors words ;
: inc ( var -- ) [ 1+ ] change ; inline
: counter ( var -- n )
global [ [ [ 0 ] unless* dup 1+ >fixnum ] change ] bind ;
: dec ( var -- ) [ 1- ] change ; inline
: bind ( namespace quot -- ) swap >n call n> drop ; inline

View File

@ -10,12 +10,12 @@ SYMBOL: recursive-state
TUPLE: value recursion uid ;
C: value ( -- value )
gensym over set-value-uid
\ value counter over set-value-uid
recursive-state get over set-value-recursion ;
M: value = eq? ;
M: value hashcode value-uid hashcode ;
M: value hashcode value-uid ;
TUPLE: literal value ;

View File

@ -19,8 +19,11 @@ M: comment pprint* ( ann -- )
: values% ( prefix values -- )
[
swap %
dup literal? [ literal-value ] [ value-uid ] if
unparse %
dup literal? [
literal-value unparse %
] [
"@" % value-uid #
] if
] each-with ;
: effect-str ( node -- str )

View File

@ -98,8 +98,7 @@ M: word (uncrossref) drop ;
M: word literalize <wrapper> ;
: gensym ( -- word )
"G:"
global [ \ gensym dup inc get ] bind
number>string append f <word> dup init-word ;
[ "G:" % \ gensym counter # ] "" make
f <word> dup init-word ;
0 \ gensym set-global