[ first define-singleton-class ] each ;
: define-enum-constructor ( word -- )
- [ name>> "<" ">" surround create-in ] keep
+ [ name>> "<" ">" surround create-word-in ] keep
[ number>enum ] curry ( number -- enum ) define-inline ;
PRIVATE>
{ [ dup "{" = ] [ drop \ } parse-until >array ] }
{ [ dup "pointer:" = ] [ drop scan-c-type <pointer> ] }
[ parse-c-type ]
- } cond ;
+ } cond ;
: reset-c-type ( word -- )
dup "struct-size" word-prop
[ *-in-c-type-name ] when ;
: (CREATE-C-TYPE) ( word -- word )
- validate-c-type-name current-vocab create {
+ validate-c-type-name current-vocab create-word {
[ fake-definition ]
[ set-last-word ]
[ reset-c-type ]
[ { } ] [ return-type-name 1array ] if-void <effect> ;
: create-function ( name -- word )
- create-in dup reset-generic ;
+ create-word-in dup reset-generic ;
:: (make-function) ( return function library types names -- quot effect )
return library function types function-quot
'[ [ _ _ _ ] dip alien-callback ] ;
:: make-callback-type ( lib return type-name types names -- word quot effect )
- type-name current-vocab create :> type-word
+ type-name current-vocab create-word :> type-word
type-word [ reset-generic ] [ reset-c-type ] bi
void* type-word typedef
type-word names return function-effect "callback-effect" set-word-prop
[ nip ] [ global-quot ] 2bi ( -- value ) define-declared ;
: define-global-setter ( type word -- )
- [ nip name>> "set-" prepend create-in ]
+ [ nip name>> "set-" prepend create-word-in ]
[ set-global-quot ] 2bi ( obj -- ) define-declared ;
: define-global ( type word -- )
: define-objc-class-word ( quot name -- )
[ class-init-hooks get set-at ]
[
- [ "cocoa.classes" create ] [ '[ _ objc-class ] ] bi
+ [ "cocoa.classes" create-word ] [ '[ _ objc-class ] ] bi
( -- class ) define-declared
] bi ;
:: define-objc-class ( name superclass protocols methods -- )
methods prepare-methods :> methods
- name "cocoa.classes" create drop
+ name "cocoa.classes" create-word drop
methods name redefine-objc-methods
name [ methods protocols superclass name (define-objc-class) ] import-objc-class ;
<PRIVATE
: hat-name ( insn -- word )
- name>> "##" ?head drop "^^" prepend create-in ;
+ name>> "##" ?head drop "^^" prepend create-word-in ;
: hat-quot ( insn -- quot )
[
name>> "," append ;
: define-insn-ctor ( class specs -- )
- [ [ insn-ctor-name create-in ] [ '[ _ ] [ f ] [ boa , ] surround ] bi ] dip
+ [ [ insn-ctor-name create-word-in ] [ '[ _ ] [ f ] [ boa , ] surround ] bi ] dip
[ name>> ] map { } <effect> define-declared ;
: define-insn ( class superclass specs -- )
registers [ H{ } clone ] initialize
: define-register ( name num size -- word )
- [ create-in ] 2dip {
+ [ create-word-in ] 2dip {
[ 2drop ]
[ 2drop define-symbol ]
[ drop "register" set-word-prop ]
SYNTAX: IS [ parse-word ] (INTERPOLATE) ;
-SYNTAX: DEFERS [ current-vocab create ] (INTERPOLATE) ;
+SYNTAX: DEFERS [ current-vocab create-word ] (INTERPOLATE) ;
-SYNTAX: DEFINES [ create-in ] (INTERPOLATE) ;
+SYNTAX: DEFINES [ create-word-in ] (INTERPOLATE) ;
-SYNTAX: DEFINES-PRIVATE [ begin-private create-in end-private ] (INTERPOLATE) ;
+SYNTAX: DEFINES-PRIVATE [ begin-private create-word-in end-private ] (INTERPOLATE) ;
SYNTAX: DEFINES-CLASS [ create-class-in ] (INTERPOLATE) ;
: defer-c-type ( c-type-name -- c-type )
deferred-type swap (CREATE-C-TYPE) [ typedef ] keep ;
-! create-in dup
+! create-word-in dup
! [ fake-definition ] [ undefined-def define ] bi ;
:: defer-types ( types type-info-class -- )
[ >c-bool ] >>unboxer-quot
[ c-bool> ] >>boxer-quot
object >>boxed-class
-"gboolean" create-in typedef
+"gboolean" create-word-in typedef
STRUCT: longdouble { data char[10] } ;
>>
[ drop deferred-type-error ] >>unboxer-quot
[ drop deferred-type-error ] >>boxer-quot
object >>boxed-class
-"deferred-type" create-in typedef
+"deferred-type" create-word-in typedef
>>
8-bit-encodings get-global at <decoder> ;
: create-encoding ( name -- word )
- create-in
+ create-word-in
[ define-singleton-class ]
[ 8-bit-encoding add-mixin-instance ]
[ ] tri ;
SYMBOL: _
: define-match-var ( name -- )
- create-in
+ create-word-in
dup t "match-var" set-word-prop
dup [ get ] curry ( -- value ) define-declared ;
] [ ] make ;
: integer-op-word ( triple -- word )
- [ name>> ] map "-" join "math.partial-dispatch" create ;
+ [ name>> ] map "-" join "math.partial-dispatch" create-word ;
: integer-op-quot ( fix-word big-word triple -- quot )
[ second ] [ third ] bi 2array {
: define-simd-128-cord ( A/2 T -- )
[ define-specialized-cord ]
- [ create-in (define-simd-128-cord) ] 2bi ;
+ [ create-word-in (define-simd-128-cord) ] 2bi ;
SYNTAX: SIMD-128-CORD:
scan-word scan-token define-simd-128-cord ;
: verify-message ( n -- word ) verify-messages get-global at ;
SYNTAX: X509_V_:
- scan-token "X509_V_" prepend create-in
+ scan-token "X509_V_" prepend create-word-in
scan-number
[ 1quotation ( -- value ) define-inline ]
[ verify-messages get set-at ]
<<
SYNTAX: ROMAN-OP:
- scan-word [ name>> "roman" prepend create-in ] keep
+ scan-word [ name>> "roman" prepend create-word-in ] keep
1quotation '[ _ binary-roman-op ]
scan-effect define-declared ;
SYNTAX: TEST:
scan-token
- [ create-in ]
+ [ create-word-in ]
[ "(" ")" surround search '[ _ parse-test ] ] bi
define-syntax ;
{ { byte-array } { string } } set-specializer ;
: create-tr ( token -- word )
- create-in dup tr-hints ;
+ create-word-in dup tr-hints ;
: tr-quot ( mapping -- quot )
'[ [ dup ascii? [ _ tr-nth ] when ] map ] ;
! break circular dependency
<<
"ui.gadgets.worlds" create-vocab drop
- "world" "ui.gadgets.worlds" create drop
+ "world" "ui.gadgets.worlds" create-word drop
"ui.gadgets.worlds" vocab-words-assoc use-words
>>
graphemes iota { SpacingMark } connect
{ Prepend } graphemes iota connect ;
-"grapheme-table" create-in
+"grapheme-table" create-word-in
graphemes init-table table
[ make-grapheme-table finish-table ] with-variable
define-constant
{ "ExtendNumLet" 12 }
}
-"word-break-table" create-in
+"word-break-table" create-word-in
"vocab:unicode/data/WordBreakProperty.txt"
load-interval-file dup array>>
[ 2 swap [ word-break-classes at ] change-nth ] each
[ { { 0 [ f ] } { 1 [ t ] } [ ] } case ] map
] map ;
-"word-table" create-in
+"word-table" create-word-in
unicode-words init-table table
[ make-word-table finish-word-table ] with-variable
define-constant
<PRIVATE
<<
-"script-table" create-in
+"script-table" create-word-in
"vocab:unicode/script/Scripts.txt" load-interval-file
define-constant
>>
V{ } clone [ (parse-com-functions) ] keep >array ;
: (iid-word) ( definition -- word )
- word>> name>> "-iid" append create-in ;
+ word>> name>> "-iid" append create-word-in ;
: (function-word) ( function interface -- word )
swap [ word>> name>> "::" ] [ name>> ] bi*
- 3append create-in ;
+ 3append create-word-in ;
: family-tree ( definition -- definitions )
dup parent>> [ family-tree ] [ { } ] if*
"KEYWORD4" "LABEL" "LITERAL1" "LITERAL2" "LITERAL3"
"LITERAL4" "MARKUP" "OPERATOR" "END" "NULL"
} [
- dup create-in dup define-symbol
+ dup create-word-in dup define-symbol
] H{ } map>assoc tokens set-global
>>
call( -- ) ! syntax-quot
-! Create some empty vocabs where the below primitives and
+! create-word some empty vocabs where the below primitives and
! classes will go
{
"alien"
tri ;
: prepare-slots ( slots -- slots' )
- [ [ dup pair? [ first2 create ] when ] map ] map ;
+ [ [ dup pair? [ first2 create-word ] when ] map ] map ;
: define-builtin-slots ( class slots -- )
prepare-slots make-slots 1 finalize-slots
: define-builtin ( symbol slotspec -- )
[ [ define-builtin-predicate ] keep ] dip define-builtin-slots ;
-"fixnum" "math" create register-builtin
-"bignum" "math" create register-builtin
-"tuple" "kernel" create register-builtin
-"float" "math" create register-builtin
+"fixnum" "math" create-word register-builtin
+"bignum" "math" create-word register-builtin
+"tuple" "kernel" create-word register-builtin
+"float" "math" create-word register-builtin
"f" "syntax" lookup-word register-builtin
-"array" "arrays" create register-builtin
-"wrapper" "kernel" create register-builtin
-"callstack" "kernel" create register-builtin
-"string" "strings" create register-builtin
-"quotation" "quotations" create register-builtin
-"dll" "alien" create register-builtin
-"alien" "alien" create register-builtin
-"word" "words" create register-builtin
-"byte-array" "byte-arrays" create register-builtin
+"array" "arrays" create-word register-builtin
+"wrapper" "kernel" create-word register-builtin
+"callstack" "kernel" create-word register-builtin
+"string" "strings" create-word register-builtin
+"quotation" "quotations" create-word register-builtin
+"dll" "alien" create-word register-builtin
+"alien" "alien" create-word register-builtin
+"word" "words" create-word register-builtin
+"byte-array" "byte-arrays" create-word register-builtin
! We need this before defining c-ptr below
"f" "syntax" lookup-word { } define-builtin
-"f" "syntax" create [ not ] "predicate" set-word-prop
+"f" "syntax" create-word [ not ] "predicate" set-word-prop
"f?" "syntax" vocab-words-assoc delete-at
"t" "syntax" lookup-word define-singleton-class
! Some unions
-"c-ptr" "alien" create [
+"c-ptr" "alien" create-word [
"alien" "alien" lookup-word ,
"f" "syntax" lookup-word ,
"byte-array" "byte-arrays" lookup-word ,
] { } make define-union-class
! A predicate class used for declarations
-"array-capacity" "sequences.private" create
+"array-capacity" "sequences.private" create-word
"fixnum" "math" lookup-word
[
[ dup 0 fixnum>= ] %
"coercer" set-word-prop
! Catch-all class for providing a default method.
-"object" "kernel" create
+"object" "kernel" create-word
[ f f { } intersection-class define-class ]
[ [ drop t ] "predicate" set-word-prop ]
bi
"object?" "kernel" vocab-words-assoc delete-at
! Empty class with no instances
-"null" "kernel" create
+"null" "kernel" create-word
[ f { } f union-class define-class ]
[ [ drop f ] "predicate" set-word-prop ]
bi
"null?" "kernel" vocab-words-assoc delete-at
-"fixnum" "math" create { } define-builtin
-"fixnum" "math" create "integer>fixnum-strict" "math" create 1quotation "coercer" set-word-prop
+"fixnum" "math" create-word { } define-builtin
+"fixnum" "math" create-word "integer>fixnum-strict" "math" create-word 1quotation "coercer" set-word-prop
-"bignum" "math" create { } define-builtin
-"bignum" "math" create ">bignum" "math" create 1quotation "coercer" set-word-prop
+"bignum" "math" create-word { } define-builtin
+"bignum" "math" create-word ">bignum" "math" create-word 1quotation "coercer" set-word-prop
-"float" "math" create { } define-builtin
-"float" "math" create ">float" "math" create 1quotation "coercer" set-word-prop
+"float" "math" create-word { } define-builtin
+"float" "math" create-word ">float" "math" create-word 1quotation "coercer" set-word-prop
-"array" "arrays" create {
+"array" "arrays" create-word {
{ "length" { "array-capacity" "sequences.private" } read-only }
} define-builtin
-"wrapper" "kernel" create {
+"wrapper" "kernel" create-word {
{ "wrapped" read-only }
} define-builtin
-"string" "strings" create {
+"string" "strings" create-word {
{ "length" { "array-capacity" "sequences.private" } read-only }
"aux"
} define-builtin
-"quotation" "quotations" create {
+"quotation" "quotations" create-word {
{ "array" { "array" "arrays" } read-only }
"cached-effect"
"cache-counter"
} define-builtin
-"dll" "alien" create {
+"dll" "alien" create-word {
{ "path" { "byte-array" "byte-arrays" } read-only }
} define-builtin
-"alien" "alien" create {
+"alien" "alien" create-word {
{ "underlying" { "c-ptr" "alien" } read-only }
"expired"
} define-builtin
-"word" "words" create {
+"word" "words" create-word {
{ "hashcode" { "fixnum" "math" } }
"name"
"vocabulary"
{ "sub-primitive" read-only }
} define-builtin
-"byte-array" "byte-arrays" create {
+"byte-array" "byte-arrays" create-word {
{ "length" { "array-capacity" "sequences.private" } read-only }
} define-builtin
-"callstack" "kernel" create { } define-builtin
+"callstack" "kernel" create-word { } define-builtin
-"tuple" "kernel" create
+"tuple" "kernel" create-word
[ { } define-builtin ]
[ define-tuple-layout ]
bi
-! Create special tombstone values
-"tombstone" "hashtables.private" create
+! create-word special tombstone values
+"tombstone" "hashtables.private" create-word
tuple
{ "state" } define-tuple-class
-"((empty))" "hashtables.private" create
+"((empty))" "hashtables.private" create-word
{ f } "tombstone" "hashtables.private" lookup-word
slots>tuple 1quotation ( -- value ) define-inline
-"((tombstone))" "hashtables.private" create
+"((tombstone))" "hashtables.private" create-word
{ t } "tombstone" "hashtables.private" lookup-word
slots>tuple 1quotation ( -- value ) define-inline
! Some tuple classes
-"curry" "kernel" create
+"curry" "kernel" create-word
tuple
{
{ "obj" read-only }
} cleave
( obj quot -- curry ) define-declared
-"compose" "kernel" create
+"compose" "kernel" create-word
tuple
{
{ "first" read-only }
! Sub-primitive words
: make-sub-primitive ( word vocab effect -- )
[
- create
+ create-word
dup t "primitive" set-word-prop
dup 1quotation
] dip define-declared ;
: make-primitive ( word vocab function effect -- )
[
[
- create
+ create-word
dup reset-word
dup t "primitive" set-word-prop
] dip
} [ first4 make-primitive ] each
! Bump build number
-"build" "kernel" create build 1 + [ ] curry ( -- n ) define-declared
+"build" "kernel" create-word build 1 + [ ] curry ( -- n ) define-declared
] with-compilation-unit
"<<<<<<<"
"======="
">>>>>>>"
- } [ "syntax" create drop ] each
+ } [ "syntax" create-word drop ] each
"t" "syntax" lookup-word define-symbol
] with-compilation-unit
PREDICATE: predicate < word "predicating" word-prop >boolean ;
: create-predicate-word ( word -- predicate )
- [ name>> "?" append ] [ vocabulary>> ] bi create
+ [ name>> "?" append ] [ vocabulary>> ] bi create-word
dup predicate? [ dup reset-generic ] unless ;
GENERIC: class-of ( object -- class )
location remember-class ;
: create-class-in ( string -- word )
- current-vocab create
+ current-vocab create-word
dup t "defining-class" set-word-prop
dup set-last-word
dup save-class-location
HELP: bad-number
{ $error-description "Indicates the parser encountered an invalid numeric literal." } ;
-HELP: create-in
+HELP: create-word-in
{ $values { "str" "a word name" } { "word" "a new word" } }
{ $description "Creates a word in the current vocabulary. Until re-defined, the word throws an error when invoked." }
$parsing-note ;
[ f ] [
"IN: parser.tests : x ( -- ) ;"
<string-reader> "a" parse-stream drop
-
"y" "parser.tests" lookup-word
] unit-test
[ t ] [ "was-once-a-word-bug" "parser.tests" lookup-word >boolean ] unit-test
[ [ ] ] [
- "IN: parser.tests USE: words << \"was-once-a-word-bug\" \"parser.tests\" create [ ] ( -- ) define-declared >>"
+ "IN: parser.tests USE: words << \"was-once-a-word-bug\" \"parser.tests\" create-word [ ] ( -- ) define-declared >>"
<string-reader> "was-once-a-word-test" parse-stream
] unit-test
[ "vocabs.loader.test.l" use-vocab ] must-fail
[ f ] [ "vocabs.loader.test.l" manifest get search-vocab-names>> in? ] unit-test
[ ] [ "vocabs.loader.test.l" unuse-vocab ] unit-test
- [ f ] [ "vocabs.loader.test.l" manifest get search-vocab-names>> in? ] unit-test
+ [ f ] [ "vocabs.loader.test.l" manifest get search-vocab-names>> in? ] unit-test
] with-file-vocabs
! Test cases for #183
M: parsing-word stack-effect drop ( parsed -- parsed ) ;
-: create-in ( str -- word )
- current-vocab create dup set-last-word dup save-location ;
+: create-word-in ( str -- word )
+ current-vocab create-word dup set-last-word dup save-location ;
SYMBOL: auto-use?
dup vocabulary>>
[ auto-use-vocab ]
[ "Added \"" "\" vocabulary to search path" surround note. ] bi
- ] [ create-in ] if ;
+ ] [ create-word-in ] if ;
: ignore-forwards ( seq -- seq' )
[ forward-reference? ] reject ;
[ invalid-word-name ] when ;
: scan-new ( -- word )
- scan-word-name create-in ;
+ scan-word-name create-word-in ;
: scan-new-word ( -- word )
scan-new dup reset-generic ;
] [ ] make ;
: reader-word ( name -- word )
- ">>" append "accessors" create
+ ">>" append "accessors" create-word
dup t "reader" set-word-prop ;
: reader-props ( slot-spec -- assoc )
] 2bi ;
: writer-word ( name -- word )
- "<<" append "accessors" create
+ "<<" append "accessors" create-word
dup t "writer" set-word-prop ;
ERROR: bad-slot-value value class ;
] 2bi ;
: setter-word ( name -- word )
- ">>" prepend "accessors" create ;
+ ">>" prepend "accessors" create-word ;
: define-setter ( name -- )
dup setter-word dup deferred? [
] [ 2drop ] if ;
: changer-word ( name -- word )
- "change-" prepend "accessors" create ;
+ "change-" prepend "accessors" create-word ;
: define-changer ( name -- )
dup changer-word dup deferred? [
] define-core-syntax
"SYMBOLS:" [
- ";" [ create-in [ reset-generic ] [ define-symbol ] bi ] each-token
+ ";" [ create-word-in [ reset-generic ] [ define-symbol ] bi ] each-token
] define-core-syntax
"SINGLETONS:" [
] define-core-syntax
"DEFER:" [
- scan-token current-vocab create
+ scan-token current-vocab create-word
[ fake-definition ] [ set-last-word ] [ undefined-def define ] tri
] define-core-syntax
[ ] [
[
- "bob" "vocabs.loader.test.b" create [ ] define
+ "bob" "vocabs.loader.test.b" create-word [ ] define
] with-compilation-unit
] unit-test
[ aaa ] [ "uutt" search ] unit-test
[ aaa ] [ "vocabs.parser.tests:aaa" search ] unit-test
- [ ] [ [ "bbb" "vocabs.parser.tests" create drop ] with-compilation-unit ] unit-test
+ [ ] [ [ "bbb" "vocabs.parser.tests" create-word drop ] with-compilation-unit ] unit-test
[ "bbb" ] [ "vocabs.parser.tests:bbb" search name>> ] unit-test
[ ] [ "vocabs.parser.tests.foo" set-current-vocab ] unit-test
- [ ] [ [ "bbb" current-vocab create drop ] with-compilation-unit ] unit-test
-
+ [ ] [ [ "bbb" current-vocab create-word drop ] with-compilation-unit ] unit-test
+
[ t ] [ "bbb" search >boolean ] unit-test
[ ] [ [ "vocabs.parser.tests.foo" forget-vocab ] with-compilation-unit ] unit-test
-
- [ [ "bbb" current-vocab create drop ] with-compilation-unit ] [ error>> no-current-vocab-error? ] must-fail-with
+
+ [ [ "bbb" current-vocab create-word drop ] with-compilation-unit ] [ error>> no-current-vocab-error? ] must-fail-with
[ begin-private ] [ error>> no-current-vocab-error? ] must-fail-with
[ end-private ] [ error>> no-current-vocab-error? ] must-fail-with
[ f ] [ "bbb" search >boolean ] unit-test
-
+
] with-manifest
$nl
"Parsing words add definitions to the current vocabulary. When a source file is being parsed, the current vocabulary is initially set to " { $vocab-link "scratchpad" } ". The current vocabulary may be changed with the " { $link POSTPONE: IN: } " parsing word (see " { $link "word-search" } ")."
{ $subsections
- create
- create-in
+ create-word
+ create-word-in
lookup-word
} ;
HELP: <word>
{ $values { "name" string } { "vocab" string } { "word" word } }
-{ $description "Allocates a word with the specified name and vocabulary. User code should call " { $link <uninterned-word> } " to create uninterned words and " { $link create } " to create interned words, instead of calling this constructor directly." }
+{ $description "Allocates a word with the specified name and vocabulary. User code should call " { $link <uninterned-word> } " to create uninterned words and " { $link create-word } " to create interned words, instead of calling this constructor directly." }
{ $notes "This word must be called from inside " { $link with-compilation-unit } "." } ;
HELP: <uninterned-word>
{ $values { "name" string } { "word" word } }
{ $description "Creates an uninterned word with the specified name, that is not equal to any other word in the system." }
-{ $notes "Unlike " { $link create } ", this word does not have to be called from inside " { $link with-compilation-unit } "." } ;
+{ $notes "Unlike " { $link create-word } ", this word does not have to be called from inside " { $link with-compilation-unit } "." } ;
HELP: gensym
{ $values { "word" word } }
"( gensym )"
}
}
-{ $notes "Unlike " { $link create } ", this word does not have to be called from inside " { $link with-compilation-unit } "." } ;
+{ $notes "Unlike " { $link create-word } ", this word does not have to be called from inside " { $link with-compilation-unit } "." } ;
HELP: bootstrapping?
{ $var-description "Set by the library while bootstrap is in progress. Some parsing words need to behave differently during bootstrap." } ;
HELP: reveal
{ $values { "word" word } }
-{ $description "Adds a newly-created word to the dictionary. Usually this word does not need to be called directly, and is only called as part of " { $link create } "." } ;
+{ $description "Adds a newly-created word to the dictionary. Usually this word does not need to be called directly, and is only called as part of " { $link create-word } "." } ;
HELP: check-create
{ $values { "name" string } { "vocab" string } }
{ $description "Throws a " { $link check-create } " error if " { $snippet "name" } " or " { $snippet "vocab" } " is not a string." }
-{ $error-description "Thrown if " { $link create } " is called with invalid parameters." } ;
+{ $error-description "Thrown if " { $link create-word } " is called with invalid parameters." } ;
-HELP: create
+HELP: create-word
{ $values { "name" string } { "vocab" string } { "word" word } }
{ $description "Creates a new word. If the vocabulary already contains a word with the requested name, outputs the existing word. The vocabulary must exist already; if it does not, you must call " { $link create-vocab } " first." }
-{ $notes "This word must be called from inside " { $link with-compilation-unit } ". Parsing words should call " { $link create-in } " instead of this word." } ;
+{ $notes "This word must be called from inside " { $link with-compilation-unit } ". Parsing words should call " { $link create-word-in } " instead of this word." } ;
HELP: constructor-word
{ $values { "name" string } { "vocab" string } { "word" word } }
[ 4 ] [
[
- "poo" "words.tests" create [ 2 2 + ] ( -- n ) define-declared
+ "poo" "words.tests" create-word [ 2 2 + ] ( -- n ) define-declared
] with-compilation-unit
"poo" "words.tests" lookup-word execute
] unit-test
\ plist-test "sample-property" word-prop
] unit-test
-[ ] [ [ "create-test" "scratchpad" create { 1 2 } "testing" set-word-prop ] with-compilation-unit ] unit-test
+[ ] [ [ "create-test" "scratchpad" create-word { 1 2 } "testing" set-word-prop ] with-compilation-unit ] unit-test
[ { 1 2 } ] [
"create-test" "scratchpad" lookup-word "testing" word-prop
[
[ t ] [ \ array? "array?" "arrays" lookup-word = ] unit-test
- [ ] [ [ "test-scope" "scratchpad" create drop ] with-compilation-unit ] unit-test
+ [ ] [ [ "test-scope" "scratchpad" create-word drop ] with-compilation-unit ] unit-test
] with-scope
[ "test-scope" ] [
[ ] [ "IN: words.tests FORGET: not-compiled" eval( -- ) ] unit-test
-[ ] [ [ "no-loc" "words.tests" create drop ] with-compilation-unit ] unit-test
+[ ] [ [ "no-loc" "words.tests" create-word drop ] with-compilation-unit ] unit-test
[ f ] [ "no-loc" "words.tests" lookup-word where ] unit-test
[ ] [ "IN: words.tests : no-loc-2 ( -- ) ;" eval( -- ) ] unit-test
2dup [ string? ] [ [ string? ] [ vocab? ] bi or ] bi* and
[ bad-create ] unless ;
-: create ( name vocab -- word )
+: create-word ( name vocab -- word )
check-create 2dup lookup-word
[ 2nip ] [
vocab-name <word>
] if* ;
: constructor-word ( name vocab -- word )
- [ "<" ">" surround ] dip create ;
+ [ "<" ">" surround ] dip create-word ;
PREDICATE: parsing-word < word "parsing" word-prop ;
[ constructor-boa-quot ] keep define-declared ;
: create-reset ( string -- word )
- create-in dup reset-generic ;
+ create-word-in dup reset-generic ;
: scan-constructor ( -- word class )
scan-new-word scan-class ;
#! that would implement that instruction.
dup " " join instruction-quotations
[
- "_" join [ "emulate-" % % ] "" make create-in
+ "_" join [ "emulate-" % % ] "" make create-word-in
dup last-instruction set-global
] dip ( cpu -- ) define-declared ;
[ current-cuda-library set-global ] bi ;
SYNTAX: CUDA-FUNCTION:
- scan-token [ create-in current-cuda-library get ] keep
+ scan-token [ create-word-in current-cuda-library get ] keep
";" scan-c-args drop define-cuda-function ;
SYNTAX: CUDA-GLOBAL:
- scan-token [ create-in current-cuda-library get ] keep
+ scan-token [ create-word-in current-cuda-library get ] keep
define-cuda-global ;
f swap open-window* dup promise>> ?promise drop ;
: define-attributes-word ( word tuple -- )
- [ name>> "-attributes" append create-in ] dip define-constant ;
+ [ name>> "-attributes" append create-word-in ] dip define-constant ;
SYNTAX: GAME:
scan-new-word
[let
(GML:) :> ( word name effect def )
- name "-record" append create-in :> record-class
+ name "-record" append create-word-in :> record-class
record-class tuple effect in>> define-tuple-class
record-class def effect in>> length
primitive-effect define-declared ;
: scan-gml-name ( -- word name )
- scan-token [ "gml-" prepend create-in ] keep ;
+ scan-token [ "gml-" prepend create-word-in ] keep ;
: (GML:) ( -- word name effect def )
scan-gml-name scan-effect parse-definition ;
SYNTAX: SOLUTION:
scan-word
- [ name>> "-main" append create-in ] keep
+ [ name>> "-main" append create-word-in ] keep
[ drop current-vocab main<< ]
[ [ . ] swap prefix ( -- ) define-declared ]
2bi ;
: make-factor-words ( module name prefix? -- call-word obj-word )
[ [ ":" glue ] [ ":$" glue ] 2bi ] [ nip dup "$" prepend ] if
- [ create-in ] bi@ ;
+ [ create-word-in ] bi@ ;
: import-getattr ( module name -- alien )
[ py-import ] dip getattr ;
'[ @ rot _ getattr -rot call-object-full @ ] ;
: method-callable ( name effect -- )
- [ dup create-in swap ] dip [ make-method-quot ] keep define-inline ;
+ [ dup create-word-in swap ] dip [ make-method-quot ] keep define-inline ;
: method-object ( name -- )
- [ "$" prepend create-in ] [ '[ _ getattr ] ] bi
+ [ "$" prepend create-word-in ] [ '[ _ getattr ] ] bi
{ "obj" } { "obj'" } <effect> define-inline ;
: add-method ( name effect -- )
: define-tuple-class-and-boa-word ( class superclass slots -- )
pick [ define-tuple-class ] dip
- dup name>> "<" ">" surround create-in swap define-boa-word ;
+ dup name>> "<" ">" surround create-word-in swap define-boa-word ;
: define-variant-member ( member -- class )
dup array? [ first3 pick [ define-tuple-class-and-boa-word ] dip ] [ dup define-singleton-class ] if ;
create-class-in [ define-mixin-class ] keep ;
: class-tuple-word ( word -- word' )
- "#" append create-in ;
+ "#" append create-word-in ;
: define-class-tuple ( word mixin -- )
[ drop class-wrapper { } define-tuple-class ]
: define-struct-constructor ( class -- )
{
- [ name>> "<" prepend ">" append create-in ]
+ [ name>> "<" prepend ">" append create-word-in ]
[ '[ _ new ] ]
[ name>> '[ _ malloc-struct >>underlying ] append ]
[ name>> 1array ]
PRIVATE>
:: define-struct-tuple ( name -- )
- name create-in :> class
+ name create-word-in :> class
class struct-wrapper { } define-tuple-class
class define-struct-constructor
name c-type fields>> [
serialize flush deserialize dup no-vocab? [ throw ] when ;
:: define-remote ( str effect addrspec vocabspec -- )
- str create-in effect [ in>> length ] [ out>> length ] bi
+ str create-word-in effect [ in>> length ] [ out>> length ] bi
'[ _ narray vocabspec str rpc-request boa addrspec 9012 <inet> binary
[ "doer" serialize send-with-check ] with-client _ firstn ]
effect define-declared ;
] if ;
: (define-relation-word) ( id-word name>> definition -- id-word )
- >r create-in over [ execute ] curry r> compose define ;
+ >r create-word-in over [ execute ] curry r> compose define ;
: define-relation-word ( relation-definition id-word given-word-name word-type definition -- relation-definition id-word )
>r >r [
[ ensure-context ensure-relation ] 2curry define ;
: create-id-word ( relation-definition -- id-word )
- dup id-word>> "id-word" choose-word-name create-in ;
+ dup id-word>> "id-word" choose-word-name create-word-in ;
PRIVATE>