1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: definitions kernel words ;
6 PREDICATE: constant < word "constant" word-prop >boolean ;
8 : define-constant ( word value -- )
9 [ drop t "constant" set-word-prop ]
10 [ [ ] curry ( -- value ) define-inline ] 2bi ;
12 M: constant reset-word
13 [ call-next-method ] [ "constant" remove-word-prop ] bi ;
15 M: constant definer drop \ CONSTANT: f ;