classes.maybe: move maybe definition from classes.union to classes.maybe
parent
fad4a28d70
commit
fac17c10ba
|
@ -1,4 +1,4 @@
|
|||
USING: accessors classes.tuple classes.union compiler.units
|
||||
USING: accessors classes.tuple classes.maybe compiler.units
|
||||
kernel math slots tools.test ;
|
||||
IN: compiler.tests.redefine26
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ words namespaces classes.algebra combinators
|
|||
combinators.short-circuit classes classes.tuple
|
||||
classes.tuple.private continuations arrays alien.c-types math
|
||||
math.private slots generic definitions stack-checker.dependencies
|
||||
classes.union classes.algebra.private
|
||||
classes.maybe classes.algebra.private
|
||||
compiler.tree
|
||||
compiler.tree.propagation.info
|
||||
compiler.tree.propagation.nodes
|
||||
|
|
|
@ -7,7 +7,7 @@ io.pathnames io.styles kernel make math math.order math.parser
|
|||
namespaces prettyprint.config prettyprint.custom
|
||||
prettyprint.sections prettyprint.stylesheet quotations sbufs
|
||||
sequences strings vectors words words.symbol hash-sets
|
||||
classes.union ;
|
||||
classes.maybe ;
|
||||
FROM: sets => members ;
|
||||
IN: prettyprint.backend
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ prettyprint.sections sequences tools.test vectors words
|
|||
effects splitting generic.standard prettyprint.private
|
||||
continuations generic compiler.units tools.continuations
|
||||
tools.continuations.private eval accessors make vocabs.parser see
|
||||
listener classes.union ;
|
||||
listener classes.maybe ;
|
||||
IN: prettyprint.tests
|
||||
|
||||
[ "4" ] [ 4 unparse ] unit-test
|
||||
|
|
|
@ -4,7 +4,7 @@ combinators.short-circuit definitions effects fry hints
|
|||
math kernel kernel.private namespaces parser quotations
|
||||
sequences slots words locals effects.parser
|
||||
locals.parser macros stack-checker.dependencies
|
||||
classes.union ;
|
||||
classes.maybe ;
|
||||
FROM: classes.tuple.private => tuple-layout ;
|
||||
IN: typed
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Doug Coleman
|
|
@ -0,0 +1,32 @@
|
|||
! Copyright (C) 2011 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors classes classes.algebra
|
||||
classes.algebra.private classes.private effects generic
|
||||
kernel sequences words classes.union classes.union.private ;
|
||||
IN: classes.maybe
|
||||
|
||||
TUPLE: maybe { class word initial: object read-only } ;
|
||||
|
||||
C: <maybe> maybe
|
||||
|
||||
M: maybe instance?
|
||||
over [ class>> instance? ] [ 2drop t ] if ;
|
||||
|
||||
M: maybe normalize-class
|
||||
class>> \ f class-or ;
|
||||
|
||||
M: maybe classoid? drop t ;
|
||||
|
||||
M: maybe rank-class drop 6 ;
|
||||
|
||||
M: maybe (flatten-class)
|
||||
class>> (flatten-class) ;
|
||||
|
||||
M: maybe effect>type ;
|
||||
|
||||
M: maybe method-word-name
|
||||
[ class>> name>> ] [ name>> ] bi* "=>" glue ;
|
||||
|
||||
M: maybe union-of-builtins?
|
||||
class>> union-of-builtins? ;
|
||||
|
|
@ -1,33 +1,14 @@
|
|||
! Copyright (C) 2004, 2011 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: words sequences kernel assocs combinators classes
|
||||
classes.private classes.algebra classes.algebra.private
|
||||
classes.builtin kernel.private math.private namespaces arrays
|
||||
math quotations definitions accessors parser effects ;
|
||||
USING: accessors assocs classes classes.algebra
|
||||
classes.algebra.private classes.builtin
|
||||
classes.private combinators definitions kernel kernel.private
|
||||
math math.private quotations sequences words vocabs ;
|
||||
IN: classes.union
|
||||
|
||||
PREDICATE: union-class < class
|
||||
"metaclass" word-prop union-class eq? ;
|
||||
|
||||
TUPLE: maybe { class word initial: object read-only } ;
|
||||
|
||||
C: <maybe> maybe
|
||||
|
||||
M: maybe instance?
|
||||
over [ class>> instance? ] [ 2drop t ] if ;
|
||||
|
||||
M: maybe normalize-class
|
||||
class>> \ f class-or ;
|
||||
|
||||
M: maybe classoid? drop t ;
|
||||
|
||||
M: maybe rank-class drop 6 ;
|
||||
|
||||
M: maybe (flatten-class)
|
||||
class>> (flatten-class) ;
|
||||
|
||||
M: maybe effect>type ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
GENERIC: union-of-builtins? ( class -- ? )
|
||||
|
@ -37,9 +18,6 @@ M: builtin-class union-of-builtins? drop t ;
|
|||
M: union-class union-of-builtins?
|
||||
members [ union-of-builtins? ] all? ;
|
||||
|
||||
M: maybe union-of-builtins?
|
||||
class>> union-of-builtins? ;
|
||||
|
||||
M: class union-of-builtins?
|
||||
drop f ;
|
||||
|
||||
|
@ -96,4 +74,3 @@ M: union-class normalize-class
|
|||
|
||||
M: union-class (flatten-class)
|
||||
members <anonymous-union> (flatten-class) ;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors words kernel sequences namespaces make assocs
|
||||
hashtables definitions kernel.private classes classes.private
|
||||
classes.algebra quotations arrays vocabs effects combinators
|
||||
sets classes.union ;
|
||||
sets ;
|
||||
FROM: namespaces => set ;
|
||||
IN: generic
|
||||
|
||||
|
@ -109,9 +109,6 @@ GENERIC: update-generic ( class generic -- )
|
|||
|
||||
GENERIC# method-word-name 1 ( class generic -- string )
|
||||
|
||||
M: maybe method-word-name
|
||||
[ class>> name>> ] [ name>> ] bi* "=>" glue ;
|
||||
|
||||
M: class method-word-name ( class generic -- string )
|
||||
[ name>> ] bi@ "=>" glue ;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: arrays byte-arrays kernel kernel.private math namespaces
|
|||
make sequences strings effects generic generic.standard
|
||||
classes classes.algebra slots.private combinators accessors
|
||||
words sequences.private assocs alien quotations hashtables
|
||||
classes.union ;
|
||||
classes.maybe ;
|
||||
IN: slots
|
||||
|
||||
TUPLE: slot-spec name offset class initial read-only ;
|
||||
|
|
|
@ -7,7 +7,7 @@ words.alias quotations io assocs splitting classes.tuple
|
|||
generic.standard generic.hook generic.math generic.parser classes
|
||||
io.pathnames vocabs vocabs.parser classes.parser classes.union
|
||||
classes.intersection classes.mixin classes.predicate
|
||||
classes.singleton classes.tuple.parser compiler.units
|
||||
classes.singleton classes.tuple.parser compiler.units classes.maybe
|
||||
combinators effects.parser slots hash-sets source-files ;
|
||||
IN: bootstrap.syntax
|
||||
|
||||
|
|
Loading…
Reference in New Issue