Paste: hooks alternative
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Fri, 3 Apr 2009 21:39:06 |
Plain Text |
SYNTAX: FALLBACK:
CREATE-CLASS dup define-singleton-class \ ; parse-until swap
'[ [ _ swap create-method-in ] [ 1quotation [ get ] prepose ] bi define ]
each ;
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Fri, 3 Apr 2009 21:47:15 |
Plain Text |
: define-fallback ( word -- )
dup define-singleton-class \ ; parse-until swap
'[ [ _ swap create-method-in ] [ 1quotation [ get ] prepose ] bi define ]
each ;
SYNTAX: FALLBACK: CREATE-CLASS define-fallback ;
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Fri, 3 Apr 2009 21:51:09 |
Plain Text |
: define-fallback ( class methods -- )
swap dup define-singleton-class
'[ [ _ swap create-method-in ] [ 1quotation [ get ] prepose ] bi define ]
each ;
SYNTAX: FALLBACK: CREATE-CLASS \ ; parse-until define-fallback ;
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Fri, 3 Apr 2009 21:55:43 |
Plain Text |
: define-fallback ( methods singleton -- )
'[ [ _ swap create-method-in ] [ 1quotation [ get ] prepose ] bi define ]
each ;
SYNTAX: FALLBACK:
CREATE-CLASS dup define-singleton-class
\ ; parse-until swap define-fallback ;
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Fri, 3 Apr 2009 22:14:31 |
Plain Text |
: add-fallback-method ( singleton method -- )
[ create-method-in ] [ 1quotation [ get ] prepose ] bi define ;
: define-fallback ( methods class -- )
dup define-singleton-class [ swap add-fallback-method ] curry each ;
SYNTAX: FALLBACK:
CREATE-CLASS \ ; parse-until swap define-fallback ;
New Annotation