vocabs: simplify M\ string require.
parent
2e73914e85
commit
9d3b5cb44b
|
@ -139,28 +139,20 @@ PREDICATE: runnable-vocab < vocab
|
||||||
|
|
||||||
INSTANCE: vocab-spec definition-mixin
|
INSTANCE: vocab-spec definition-mixin
|
||||||
|
|
||||||
: call-require-hook ( name -- )
|
|
||||||
require-hook get call( name -- ) ;
|
|
||||||
|
|
||||||
GENERIC: require ( object -- )
|
GENERIC: require ( object -- )
|
||||||
|
|
||||||
M: vocab require name>> require ;
|
M: vocab require name>> require ;
|
||||||
|
|
||||||
M: vocab-link require name>> require ;
|
M: vocab-link require name>> require ;
|
||||||
|
|
||||||
! When calling "foo.private" require, load "foo" instead, but only when
|
! When calling "foo.private" require, load "foo" instead, but
|
||||||
! "foo.private" does not exist. The reason for this is that stage1 bootstrap
|
! only when "foo.private" does not exist. The reason for this is
|
||||||
! starts out with some .private vocabs that contain primitives, and
|
! that stage1 bootstrap starts out with some .private vocabs
|
||||||
! loading the public vocabs would cause circularity issues.
|
! that contain primitives, and loading the public vocabs would
|
||||||
M: string require ( vocab -- )
|
! cause circularity issues.
|
||||||
dup ".private" ?tail [
|
M: string require
|
||||||
over lookup-vocab
|
[ ".private" ?tail ] keep swap [ lookup-vocab not ] when
|
||||||
[ 2drop ]
|
[ require-hook get call( name -- ) ] [ drop ] if ;
|
||||||
[ nip call-require-hook ]
|
|
||||||
if
|
|
||||||
] [
|
|
||||||
nip call-require-hook
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: load-vocab ( name -- vocab )
|
: load-vocab ( name -- vocab )
|
||||||
[ require ] [ lookup-vocab ] bi ;
|
[ require ] [ lookup-vocab ] bi ;
|
||||||
|
|
Loading…
Reference in New Issue