From 571ef865e6ccddc29bf5677132ffacefc0f23608 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Sun, 18 Sep 2011 19:00:30 -0700 Subject: [PATCH] slots: pre-create the "at", "nth", and "global" slots to make deterministic the currently nondeterministic ambiguity between accessors:change-* and assocs:change-at, sequences:change-nth, and namespaces:change-global --- basis/bit-arrays/bit-arrays.factor | 1 + basis/checksums/md5/md5.factor | 1 + basis/compiler/cfg/dce/dce.factor | 1 + .../cfg/linear-scan/allocation/state/state.factor | 1 + basis/compiler/cfg/linear-scan/linear-scan.factor | 1 + .../cfg/representations/selection/selection.factor | 1 + basis/compiler/cfg/ssa/construction/construction.factor | 1 + basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor | 1 + .../tree/modular-arithmetic/modular-arithmetic.factor | 1 + basis/core-foundation/fsevents/fsevents.factor | 1 + basis/disjoint-sets/disjoint-sets.factor | 1 + basis/documents/documents.factor | 1 + basis/game/input/dinput/dinput.factor | 1 + basis/game/input/input.factor | 1 + basis/game/input/iokit/iokit.factor | 1 + basis/gobject-introspection/gobject-introspection.factor | 1 + basis/persistent/vectors/vectors.factor | 1 + basis/random/sfmt/sfmt.factor | 1 + basis/sequences/product/product.factor | 1 + basis/threads/threads.factor | 1 + basis/tools/deploy/shaker/shaker.factor | 2 ++ basis/ui/backend/windows/windows.factor | 2 +- basis/ui/gadgets/tables/tables.factor | 1 + basis/ui/ui.factor | 1 + basis/unicode/breaks/breaks.factor | 1 + core/generic/single/single.factor | 1 + core/slots/slots.factor | 8 ++++++++ core/words/words.factor | 1 + extra/benchmark/hashtables/hashtables.factor | 3 ++- extra/bloom-filters/bloom-filters.factor | 1 + extra/boyer-moore/boyer-moore.factor | 1 + extra/bunny/model/model.factor | 1 + extra/compiler/graphviz/graphviz.factor | 3 ++- extra/game/worlds/worlds.factor | 1 + extra/math/splines/splines.factor | 1 + extra/poker/poker.factor | 1 + extra/project-euler/common/common.factor | 1 + extra/twitter/twitter.factor | 1 + extra/wordtimer/wordtimer.factor | 1 + 39 files changed, 49 insertions(+), 3 deletions(-) diff --git a/basis/bit-arrays/bit-arrays.factor b/basis/bit-arrays/bit-arrays.factor index 6097bed4f91..70935ebfa71 100644 --- a/basis/bit-arrays/bit-arrays.factor +++ b/basis/bit-arrays/bit-arrays.factor @@ -4,6 +4,7 @@ USING: alien alien.data accessors io.binary math math.bitwise alien.accessors kernel kernel.private sequences sequences.private byte-arrays parser prettyprint.custom fry locals ; +FROM: sequences.private => change-nth-unsafe ; IN: bit-arrays TUPLE: bit-array diff --git a/basis/checksums/md5/md5.factor b/basis/checksums/md5/md5.factor index b2af09b7d59..a1cb548e6a4 100644 --- a/basis/checksums/md5/md5.factor +++ b/basis/checksums/md5/md5.factor @@ -6,6 +6,7 @@ splitting grouping strings sequences byte-arrays locals sequences.private macros fry io.encodings.binary math.bitwise checksums accessors checksums.common checksums.stream combinators combinators.smart specialized-arrays literals hints ; +FROM: sequences.private => change-nth-unsafe ; SPECIALIZED-ARRAY: uint IN: checksums.md5 diff --git a/basis/compiler/cfg/dce/dce.factor b/basis/compiler/cfg/dce/dce.factor index db41b0c18dd..1a5d2648911 100644 --- a/basis/compiler/cfg/dce/dce.factor +++ b/basis/compiler/cfg/dce/dce.factor @@ -3,6 +3,7 @@ USING: accessors arrays assocs kernel namespaces sequences compiler.cfg.instructions compiler.cfg.def-use compiler.cfg.rpo compiler.cfg.predecessors hash-sets sets ; +FROM: assocs => change-at ; FROM: namespaces => set ; IN: compiler.cfg.dce diff --git a/basis/compiler/cfg/linear-scan/allocation/state/state.factor b/basis/compiler/cfg/linear-scan/allocation/state/state.factor index 827b878d68d..7f98e53688e 100644 --- a/basis/compiler/cfg/linear-scan/allocation/state/state.factor +++ b/basis/compiler/cfg/linear-scan/allocation/state/state.factor @@ -5,6 +5,7 @@ heaps kernel math math.order namespaces layouts sequences vectors linked-assocs compiler.cfg compiler.cfg.registers compiler.cfg.instructions compiler.cfg.linear-scan.live-intervals ; +FROM: assocs => change-at ; IN: compiler.cfg.linear-scan.allocation.state ! Start index of current live interval. We ensure that all diff --git a/basis/compiler/cfg/linear-scan/linear-scan.factor b/basis/compiler/cfg/linear-scan/linear-scan.factor index 5f1abd31658..d3ee2f6fbb4 100644 --- a/basis/compiler/cfg/linear-scan/linear-scan.factor +++ b/basis/compiler/cfg/linear-scan/linear-scan.factor @@ -12,6 +12,7 @@ compiler.cfg.linear-scan.allocation compiler.cfg.linear-scan.allocation.state compiler.cfg.linear-scan.assignment compiler.cfg.linear-scan.resolve ; +FROM: assocs => change-at ; IN: compiler.cfg.linear-scan ! References: diff --git a/basis/compiler/cfg/representations/selection/selection.factor b/basis/compiler/cfg/representations/selection/selection.factor index 330e5d8e2ad..d0e156f31ea 100644 --- a/basis/compiler/cfg/representations/selection/selection.factor +++ b/basis/compiler/cfg/representations/selection/selection.factor @@ -12,6 +12,7 @@ compiler.cfg.rpo compiler.cfg.utilities compiler.utilities cpu.architecture ; +FROM: assocs => change-at ; FROM: namespaces => set ; IN: compiler.cfg.representations.selection diff --git a/basis/compiler/cfg/ssa/construction/construction.factor b/basis/compiler/cfg/ssa/construction/construction.factor index 57932253495..4f156f38d64 100644 --- a/basis/compiler/cfg/ssa/construction/construction.factor +++ b/basis/compiler/cfg/ssa/construction/construction.factor @@ -11,6 +11,7 @@ compiler.cfg.instructions compiler.cfg.renaming compiler.cfg.renaming.functor compiler.cfg.ssa.construction.tdmsc ; +FROM: assocs => change-at ; FROM: namespaces => set ; IN: compiler.cfg.ssa.construction diff --git a/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor b/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor index 4cdc290c415..75d9d80f378 100644 --- a/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor +++ b/basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor @@ -4,6 +4,7 @@ USING: accessors arrays assocs bit-arrays bit-sets fry hashtables hints kernel locals math namespaces sequences sets compiler.cfg compiler.cfg.dominance compiler.cfg.rpo ; FROM: namespaces => set ; +FROM: assocs => change-at ; IN: compiler.cfg.ssa.construction.tdmsc ! TDMSC-I algorithm from "A Practical and Fast Iterative Algorithm for diff --git a/basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor b/basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor index 961ce1ecd71..aac165dff92 100644 --- a/basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor +++ b/basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor @@ -10,6 +10,7 @@ compiler.tree.def-use compiler.tree.def-use.simplified compiler.tree.late-optimizations ; FROM: namespaces => set ; +FROM: assocs => change-at ; IN: compiler.tree.modular-arithmetic ! This is a late-stage optimization. diff --git a/basis/core-foundation/fsevents/fsevents.factor b/basis/core-foundation/fsevents/fsevents.factor index fd17843bf3d..0c91197dee5 100644 --- a/basis/core-foundation/fsevents/fsevents.factor +++ b/basis/core-foundation/fsevents/fsevents.factor @@ -6,6 +6,7 @@ continuations combinators io.encodings.utf8 destructors locals arrays specialized-arrays classes.struct core-foundation core-foundation.arrays core-foundation.run-loop core-foundation.strings core-foundation.time unix.types ; +FROM: namespaces => change-global ; IN: core-foundation.fsevents SPECIALIZED-ARRAY: void* diff --git a/basis/disjoint-sets/disjoint-sets.factor b/basis/disjoint-sets/disjoint-sets.factor index a158302ecc0..8332632d069 100644 --- a/basis/disjoint-sets/disjoint-sets.factor +++ b/basis/disjoint-sets/disjoint-sets.factor @@ -2,6 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays hints kernel locals math hashtables assocs fry sequences ; +FROM: assocs => change-at ; IN: disjoint-sets TUPLE: disjoint-set diff --git a/basis/documents/documents.factor b/basis/documents/documents.factor index e84a993eeaa..bdd94824da8 100644 --- a/basis/documents/documents.factor +++ b/basis/documents/documents.factor @@ -4,6 +4,7 @@ USING: accessors arrays io kernel math models namespaces make sequences strings splitting combinators unicode.categories math.order math.ranges fry locals ; FROM: models => change-model ; +FROM: sequences => change-nth ; IN: documents : +col ( loc n -- newloc ) [ first2 ] dip + 2array ; diff --git a/basis/game/input/dinput/dinput.factor b/basis/game/input/dinput/dinput.factor index fd9d992f138..f38b60844a3 100755 --- a/basis/game/input/dinput/dinput.factor +++ b/basis/game/input/dinput/dinput.factor @@ -7,6 +7,7 @@ specialized-arrays ui.backend.windows vectors windows.com windows.directx.dinput windows.directx.dinput.constants windows.kernel32 windows.messages windows.ole32 windows.errors windows.user32 classes.struct ; +FROM: namespaces => change-global ; SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA IN: game.input.dinput diff --git a/basis/game/input/input.factor b/basis/game/input/input.factor index eb01e94b992..cdbaebcf76e 100644 --- a/basis/game/input/input.factor +++ b/basis/game/input/input.factor @@ -1,5 +1,6 @@ USING: arrays accessors continuations kernel math system sequences namespaces init vocabs vocabs.loader combinators ; +FROM: namespaces => change-global ; IN: game.input SYMBOLS: game-input-backend game-input-opened ; diff --git a/basis/game/input/iokit/iokit.factor b/basis/game/input/iokit/iokit.factor index 3a953e8babf..47597b931ed 100644 --- a/basis/game/input/iokit/iokit.factor +++ b/basis/game/input/iokit/iokit.factor @@ -6,6 +6,7 @@ namespaces assocs arrays combinators hints alien core-foundation.run-loop accessors sequences.private alien.c-types alien.data math parser game.input vectors bit-arrays unix.types ; +FROM: namespaces => change-global ; IN: game.input.iokit SINGLETON: iokit-game-input-backend diff --git a/basis/gobject-introspection/gobject-introspection.factor b/basis/gobject-introspection/gobject-introspection.factor index 48d8bae4625..49735453331 100755 --- a/basis/gobject-introspection/gobject-introspection.factor +++ b/basis/gobject-introspection/gobject-introspection.factor @@ -5,6 +5,7 @@ gobject-introspection.ffi gobject-introspection.loader gobject-introspection.types io io.files io.pathnames kernel lexer locals make namespaces parser sequences splitting summary vocabs vocabs.parser xml ; +FROM: namespaces => change-global ; IN: gobject-introspection ERROR: gir-not-found name paths ; diff --git a/basis/persistent/vectors/vectors.factor b/basis/persistent/vectors/vectors.factor index b02604e9bd8..6b253aef993 100644 --- a/basis/persistent/vectors/vectors.factor +++ b/basis/persistent/vectors/vectors.factor @@ -3,6 +3,7 @@ USING: math accessors kernel sequences.private sequences arrays combinators combinators.short-circuit parser prettyprint.custom persistent.sequences ; +FROM: sequences => change-nth ; IN: persistent.vectors change-nth ; SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint-4 IN: random.sfmt diff --git a/basis/sequences/product/product.factor b/basis/sequences/product/product.factor index 487d7b2ecac..b8865c7e4af 100644 --- a/basis/sequences/product/product.factor +++ b/basis/sequences/product/product.factor @@ -1,5 +1,6 @@ ! (c)2009 Joe Groff bsd license USING: accessors arrays assocs kernel locals math sequences ; +FROM: sequences => change-nth ; IN: sequences.product TUPLE: product-sequence { sequences array read-only } { lengths array read-only } ; diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor index fe4f2a0f240..4ab462ff66f 100644 --- a/basis/threads/threads.factor +++ b/basis/threads/threads.factor @@ -5,6 +5,7 @@ USING: alien.private arrays hashtables heaps kernel kernel.private math namespaces sequences vectors continuations continuations.private dlists assocs system combinators init boxes accessors math.order deques strings quotations fry ; +FROM: assocs => change-at ; IN: threads change-at ; FROM: namespaces => set ; +FROM: sequences => change-nth ; FROM: sets => members ; IN: tools.deploy.shaker diff --git a/basis/ui/backend/windows/windows.factor b/basis/ui/backend/windows/windows.factor index 9e49a1b0446..559a89217e1 100755 --- a/basis/ui/backend/windows/windows.factor +++ b/basis/ui/backend/windows/windows.factor @@ -14,7 +14,7 @@ accessors math.rectangles math.order calendar ascii sets io.encodings.utf16n windows.errors literals ui.pixel-formats ui.pixel-formats.private memoize classes colors specialized-arrays classes.struct ; -FROM: namespaces => set ; +FROM: namespaces => change-global set ; SPECIALIZED-ARRAY: POINT QUALIFIED-WITH: alien.c-types c IN: ui.backend.windows diff --git a/basis/ui/gadgets/tables/tables.factor b/basis/ui/gadgets/tables/tables.factor index f4fee894102..9f12eef3c3e 100644 --- a/basis/ui/gadgets/tables/tables.factor +++ b/basis/ui/gadgets/tables/tables.factor @@ -8,6 +8,7 @@ ui.gestures ui.render ui.pens.solid ui.text ui.commands ui.images ui.gadgets.menus ui.gadgets.line-support models combinators combinators.short-circuit fonts locals splitting strings sets sorting ; +FROM: sequences => change-nth ; IN: ui.gadgets.tables ! Row rendererer protocol diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 68bb064328d..47f674bbcdf 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -7,6 +7,7 @@ destructors dlists fry init kernel lexer make math namespaces parser sequences sets strings threads ui.backend ui.gadgets ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser words ; +FROM: namespaces => change-global ; IN: ui change-nth ; IN: unicode.breaks change-at ; IN: generic.single ERROR: no-method object generic ; diff --git a/core/slots/slots.factor b/core/slots/slots.factor index 6c7881b3ad7..35a459b8882 100644 --- a/core/slots/slots.factor +++ b/core/slots/slots.factor @@ -229,3 +229,11 @@ M: slot-spec make-slot : slot-named ( name specs -- spec/f ) slot-named* nip ; + +! Predefine some slots, because there are change-* words in other vocabs +! that nondeterministically cause ambiguities when USEd alongside +! accessors + +SLOT: at +SLOT: nth +SLOT: global diff --git a/core/words/words.factor b/core/words/words.factor index e6ed220bc5a..46841af079b 100644 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -4,6 +4,7 @@ USING: accessors arrays definitions kernel kernel.private slots.private math namespaces sequences strings vectors sbufs quotations assocs hashtables sorting vocabs math.order sets words.private ; +FROM: assocs => change-at ; IN: words : word ( -- word ) \ word get-global ; diff --git a/extra/benchmark/hashtables/hashtables.factor b/extra/benchmark/hashtables/hashtables.factor index 065ad9c34a4..2ad485b5722 100644 --- a/extra/benchmark/hashtables/hashtables.factor +++ b/extra/benchmark/hashtables/hashtables.factor @@ -3,6 +3,7 @@ USING: accessors assocs combinators kernel locals math math.ranges memoize sequences strings hashtables math.parser grouping ; +FROM: assocs => change-at ; IN: benchmark.hashtables MEMO: strings ( -- str ) @@ -72,4 +73,4 @@ M: collision hashcode* value>> hashcode* 15 bitand ; ] times drop ; -MAIN: hashtable-benchmark \ No newline at end of file +MAIN: hashtable-benchmark diff --git a/extra/bloom-filters/bloom-filters.factor b/extra/bloom-filters/bloom-filters.factor index 0f14ed1d975..022bac47c64 100644 --- a/extra/bloom-filters/bloom-filters.factor +++ b/extra/bloom-filters/bloom-filters.factor @@ -6,6 +6,7 @@ IN: bloom-filters FROM: math.ranges => [1,b] ; FROM: math.intervals => (a,b) interval-contains? ; +FROM: sequences => change-nth ; /* diff --git a/extra/boyer-moore/boyer-moore.factor b/extra/boyer-moore/boyer-moore.factor index aba3f614a12..54340a50ba7 100644 --- a/extra/boyer-moore/boyer-moore.factor +++ b/extra/boyer-moore/boyer-moore.factor @@ -2,6 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs kernel locals math math.order math.ranges sequences sequences.private z-algorithm ; +FROM: sequences.private => change-nth-unsafe ; IN: boyer-moore change-nth ; QUALIFIED-WITH: alien.c-types c SPECIALIZED-ARRAY: c:float SPECIALIZED-ARRAY: c:uint diff --git a/extra/compiler/graphviz/graphviz.factor b/extra/compiler/graphviz/graphviz.factor index 3e9dbc28491..0288e1d0abd 100644 --- a/extra/compiler/graphviz/graphviz.factor +++ b/extra/compiler/graphviz/graphviz.factor @@ -7,6 +7,7 @@ compiler.cfg.utilities compiler.tree.recursive images.viewer images.png io io.encodings.ascii io.files io.files.unique io.launcher kernel math.parser sequences assocs arrays make math namespaces quotations combinators locals words ; +FROM: assocs => change-at ; IN: compiler.graphviz : quotes ( str -- str' ) "\"" "\"" surround ; @@ -138,4 +139,4 @@ SYMBOL: vertex-names dup quotation? [ build-tree ] when analyze-recursive drop [ [ call-graph get call-graph-edges ] "Call graph" graph, ] - render-graph ; \ No newline at end of file + render-graph ; diff --git a/extra/game/worlds/worlds.factor b/extra/game/worlds/worlds.factor index b327846d942..8ce720f983a 100644 --- a/extra/game/worlds/worlds.factor +++ b/extra/game/worlds/worlds.factor @@ -3,6 +3,7 @@ USING: accessors audio.engine combinators concurrency.promises destructors fry game.input game.loop generic kernel math parser sequences threads ui ui.gadgets ui.gadgets.worlds ui.gestures words words.constant ; +FROM: namespaces => change-global ; IN: game.worlds TUPLE: game-world < world diff --git a/extra/math/splines/splines.factor b/extra/math/splines/splines.factor index dc22224416e..530db255221 100644 --- a/extra/math/splines/splines.factor +++ b/extra/math/splines/splines.factor @@ -4,6 +4,7 @@ USING: accessors combinators kernel locals math math.combinatorics math.polynomials opengl.gl sequences ui.gadgets ui.gadgets.panes ui.render arrays grouping math.vectors assocs ui.gestures ; +FROM: sequences => change-nth ; IN: math.splines change-nth ; IN: poker ! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with diff --git a/extra/project-euler/common/common.factor b/extra/project-euler/common/common.factor index 7474850f8f1..5b83a7d6407 100644 --- a/extra/project-euler/common/common.factor +++ b/extra/project-euler/common/common.factor @@ -6,6 +6,7 @@ USING: accessors arrays byte-arrays fry hints kernel lists make math math.primes.lists math.primes.miller-rabin math.ranges math.ratios namespaces parser prettyprint quotations sequences sorting strings unicode.case vocabs vocabs.parser words ; +FROM: sequences => change-nth ; IN: project-euler.common ! A collection of words used by more than one Project Euler solution diff --git a/extra/twitter/twitter.factor b/extra/twitter/twitter.factor index 81a676ec245..5cba69d8e30 100644 --- a/extra/twitter/twitter.factor +++ b/extra/twitter/twitter.factor @@ -3,6 +3,7 @@ USING: accessors assocs combinators hashtables http http.client json.reader kernel macros namespaces sequences io.sockets.secure fry oauth urls ; +FROM: assocs => change-at ; IN: twitter ! Configuration diff --git a/extra/wordtimer/wordtimer.factor b/extra/wordtimer/wordtimer.factor index abf6a536578..6de6a88d616 100644 --- a/extra/wordtimer/wordtimer.factor +++ b/extra/wordtimer/wordtimer.factor @@ -1,6 +1,7 @@ USING: kernel sequences namespaces make math assocs words arrays tools.annotations vocabs sorting prettyprint io system math.statistics accessors tools.time fry ; +FROM: namespaces => change-global ; IN: wordtimer SYMBOL: *wordtimes*