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