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

db4
Joe Groff 2011-09-18 19:00:30 -07:00
parent 867b5a1178
commit 2bd6de9a02
39 changed files with 49 additions and 3 deletions

View File

@ -4,6 +4,7 @@ USING: alien alien.data accessors io.binary math math.bitwise
alien.accessors kernel kernel.private sequences alien.accessors kernel kernel.private sequences
sequences.private byte-arrays parser prettyprint.custom fry sequences.private byte-arrays parser prettyprint.custom fry
locals ; locals ;
FROM: sequences.private => change-nth-unsafe ;
IN: bit-arrays IN: bit-arrays
TUPLE: bit-array TUPLE: bit-array

View File

@ -6,6 +6,7 @@ splitting grouping strings sequences byte-arrays locals
sequences.private macros fry io.encodings.binary math.bitwise sequences.private macros fry io.encodings.binary math.bitwise
checksums accessors checksums.common checksums.stream checksums accessors checksums.common checksums.stream
combinators combinators.smart specialized-arrays literals hints ; combinators combinators.smart specialized-arrays literals hints ;
FROM: sequences.private => change-nth-unsafe ;
SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint
IN: checksums.md5 IN: checksums.md5

View File

@ -3,6 +3,7 @@
USING: accessors arrays assocs kernel namespaces sequences USING: accessors arrays assocs kernel namespaces sequences
compiler.cfg.instructions compiler.cfg.def-use compiler.cfg.instructions compiler.cfg.def-use
compiler.cfg.rpo compiler.cfg.predecessors hash-sets sets ; compiler.cfg.rpo compiler.cfg.predecessors hash-sets sets ;
FROM: assocs => change-at ;
FROM: namespaces => set ; FROM: namespaces => set ;
IN: compiler.cfg.dce IN: compiler.cfg.dce

View File

@ -5,6 +5,7 @@ heaps kernel math math.order namespaces layouts sequences vectors
linked-assocs compiler.cfg compiler.cfg.registers linked-assocs compiler.cfg compiler.cfg.registers
compiler.cfg.instructions compiler.cfg.instructions
compiler.cfg.linear-scan.live-intervals ; compiler.cfg.linear-scan.live-intervals ;
FROM: assocs => change-at ;
IN: compiler.cfg.linear-scan.allocation.state IN: compiler.cfg.linear-scan.allocation.state
! Start index of current live interval. We ensure that all ! Start index of current live interval. We ensure that all

View File

@ -12,6 +12,7 @@ compiler.cfg.linear-scan.allocation
compiler.cfg.linear-scan.allocation.state compiler.cfg.linear-scan.allocation.state
compiler.cfg.linear-scan.assignment compiler.cfg.linear-scan.assignment
compiler.cfg.linear-scan.resolve ; compiler.cfg.linear-scan.resolve ;
FROM: assocs => change-at ;
IN: compiler.cfg.linear-scan IN: compiler.cfg.linear-scan
! References: ! References:

View File

@ -12,6 +12,7 @@ compiler.cfg.rpo
compiler.cfg.utilities compiler.cfg.utilities
compiler.utilities compiler.utilities
cpu.architecture ; cpu.architecture ;
FROM: assocs => change-at ;
FROM: namespaces => set ; FROM: namespaces => set ;
IN: compiler.cfg.representations.selection IN: compiler.cfg.representations.selection

View File

@ -11,6 +11,7 @@ compiler.cfg.instructions
compiler.cfg.renaming compiler.cfg.renaming
compiler.cfg.renaming.functor compiler.cfg.renaming.functor
compiler.cfg.ssa.construction.tdmsc ; compiler.cfg.ssa.construction.tdmsc ;
FROM: assocs => change-at ;
FROM: namespaces => set ; FROM: namespaces => set ;
IN: compiler.cfg.ssa.construction IN: compiler.cfg.ssa.construction

View File

@ -4,6 +4,7 @@ USING: accessors arrays assocs bit-arrays bit-sets fry
hashtables hints kernel locals math namespaces sequences sets hashtables hints kernel locals math namespaces sequences sets
compiler.cfg compiler.cfg.dominance compiler.cfg.rpo ; compiler.cfg compiler.cfg.dominance compiler.cfg.rpo ;
FROM: namespaces => set ; FROM: namespaces => set ;
FROM: assocs => change-at ;
IN: compiler.cfg.ssa.construction.tdmsc IN: compiler.cfg.ssa.construction.tdmsc
! TDMSC-I algorithm from "A Practical and Fast Iterative Algorithm for ! TDMSC-I algorithm from "A Practical and Fast Iterative Algorithm for

View File

@ -10,6 +10,7 @@ compiler.tree.def-use
compiler.tree.def-use.simplified compiler.tree.def-use.simplified
compiler.tree.late-optimizations ; compiler.tree.late-optimizations ;
FROM: namespaces => set ; FROM: namespaces => set ;
FROM: assocs => change-at ;
IN: compiler.tree.modular-arithmetic IN: compiler.tree.modular-arithmetic
! This is a late-stage optimization. ! This is a late-stage optimization.

View File

@ -6,6 +6,7 @@ continuations combinators io.encodings.utf8 destructors locals
arrays specialized-arrays classes.struct core-foundation arrays specialized-arrays classes.struct core-foundation
core-foundation.arrays core-foundation.run-loop core-foundation.arrays core-foundation.run-loop
core-foundation.strings core-foundation.time unix.types ; core-foundation.strings core-foundation.time unix.types ;
FROM: namespaces => change-global ;
IN: core-foundation.fsevents IN: core-foundation.fsevents
SPECIALIZED-ARRAY: void* SPECIALIZED-ARRAY: void*

View File

@ -2,6 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays hints kernel locals math hashtables USING: accessors arrays hints kernel locals math hashtables
assocs fry sequences ; assocs fry sequences ;
FROM: assocs => change-at ;
IN: disjoint-sets IN: disjoint-sets
TUPLE: disjoint-set TUPLE: disjoint-set

View File

@ -4,6 +4,7 @@ USING: accessors arrays io kernel math models namespaces make
sequences strings splitting combinators unicode.categories sequences strings splitting combinators unicode.categories
math.order math.ranges fry locals ; math.order math.ranges fry locals ;
FROM: models => change-model ; FROM: models => change-model ;
FROM: sequences => change-nth ;
IN: documents IN: documents
: +col ( loc n -- newloc ) [ first2 ] dip + 2array ; : +col ( loc n -- newloc ) [ first2 ] dip + 2array ;

View File

@ -7,6 +7,7 @@ specialized-arrays ui.backend.windows vectors windows.com
windows.directx.dinput windows.directx.dinput.constants windows.directx.dinput windows.directx.dinput.constants
windows.kernel32 windows.messages windows.ole32 windows.errors windows.kernel32 windows.messages windows.ole32 windows.errors
windows.user32 classes.struct ; windows.user32 classes.struct ;
FROM: namespaces => change-global ;
SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA SPECIALIZED-ARRAY: DIDEVICEOBJECTDATA
IN: game.input.dinput IN: game.input.dinput

View File

@ -1,5 +1,6 @@
USING: arrays accessors continuations kernel math system USING: arrays accessors continuations kernel math system
sequences namespaces init vocabs vocabs.loader combinators ; sequences namespaces init vocabs vocabs.loader combinators ;
FROM: namespaces => change-global ;
IN: game.input IN: game.input
SYMBOLS: game-input-backend game-input-opened ; SYMBOLS: game-input-backend game-input-opened ;

View File

@ -6,6 +6,7 @@ namespaces assocs arrays combinators hints alien
core-foundation.run-loop accessors sequences.private core-foundation.run-loop accessors sequences.private
alien.c-types alien.data math parser game.input vectors alien.c-types alien.data math parser game.input vectors
bit-arrays unix.types ; bit-arrays unix.types ;
FROM: namespaces => change-global ;
IN: game.input.iokit IN: game.input.iokit
SINGLETON: iokit-game-input-backend SINGLETON: iokit-game-input-backend

View File

@ -5,6 +5,7 @@ gobject-introspection.ffi gobject-introspection.loader
gobject-introspection.types io io.files io.pathnames kernel lexer gobject-introspection.types io io.files io.pathnames kernel lexer
locals make namespaces parser sequences splitting summary vocabs locals make namespaces parser sequences splitting summary vocabs
vocabs.parser xml ; vocabs.parser xml ;
FROM: namespaces => change-global ;
IN: gobject-introspection IN: gobject-introspection
ERROR: gir-not-found name paths ; ERROR: gir-not-found name paths ;

View File

@ -3,6 +3,7 @@
USING: math accessors kernel sequences.private sequences arrays USING: math accessors kernel sequences.private sequences arrays
combinators combinators.short-circuit parser prettyprint.custom combinators combinators.short-circuit parser prettyprint.custom
persistent.sequences ; persistent.sequences ;
FROM: sequences => change-nth ;
IN: persistent.vectors IN: persistent.vectors
<PRIVATE <PRIVATE

View File

@ -4,6 +4,7 @@ USING: accessors alien.c-types alien.data kernel locals math
math.ranges math.bitwise math.vectors math.vectors.simd random math.ranges math.bitwise math.vectors math.vectors.simd random
sequences specialized-arrays sequences.private classes.struct sequences specialized-arrays sequences.private classes.struct
combinators.short-circuit fry ; combinators.short-circuit fry ;
FROM: sequences => change-nth ;
SPECIALIZED-ARRAY: uint SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: uint-4 SPECIALIZED-ARRAY: uint-4
IN: random.sfmt IN: random.sfmt

View File

@ -1,5 +1,6 @@
! (c)2009 Joe Groff bsd license ! (c)2009 Joe Groff bsd license
USING: accessors arrays assocs kernel locals math sequences ; USING: accessors arrays assocs kernel locals math sequences ;
FROM: sequences => change-nth ;
IN: sequences.product IN: sequences.product
TUPLE: product-sequence { sequences array read-only } { lengths array read-only } ; TUPLE: product-sequence { sequences array read-only } { lengths array read-only } ;

View File

@ -5,6 +5,7 @@ USING: alien.private arrays hashtables heaps kernel kernel.private
math namespaces sequences vectors continuations continuations.private math namespaces sequences vectors continuations continuations.private
dlists assocs system combinators init boxes accessors math.order dlists assocs system combinators init boxes accessors math.order
deques strings quotations fry ; deques strings quotations fry ;
FROM: assocs => change-at ;
IN: threads IN: threads
<PRIVATE <PRIVATE

View File

@ -22,7 +22,9 @@ QUALIFIED: source-files
QUALIFIED: source-files.errors QUALIFIED: source-files.errors
QUALIFIED: vocabs QUALIFIED: vocabs
QUALIFIED: vocabs.loader QUALIFIED: vocabs.loader
FROM: assocs => change-at ;
FROM: namespaces => set ; FROM: namespaces => set ;
FROM: sequences => change-nth ;
FROM: sets => members ; FROM: sets => members ;
IN: tools.deploy.shaker IN: tools.deploy.shaker

View File

@ -14,7 +14,7 @@ accessors math.rectangles math.order calendar ascii sets
io.encodings.utf16n windows.errors literals ui.pixel-formats io.encodings.utf16n windows.errors literals ui.pixel-formats
ui.pixel-formats.private memoize classes colors ui.pixel-formats.private memoize classes colors
specialized-arrays classes.struct ; specialized-arrays classes.struct ;
FROM: namespaces => set ; FROM: namespaces => change-global set ;
SPECIALIZED-ARRAY: POINT SPECIALIZED-ARRAY: POINT
QUALIFIED-WITH: alien.c-types c QUALIFIED-WITH: alien.c-types c
IN: ui.backend.windows IN: ui.backend.windows

View File

@ -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 ui.gadgets.menus ui.gadgets.line-support models combinators
combinators.short-circuit fonts locals splitting strings sets combinators.short-circuit fonts locals splitting strings sets
sorting ; sorting ;
FROM: sequences => change-nth ;
IN: ui.gadgets.tables IN: ui.gadgets.tables
! Row rendererer protocol ! Row rendererer protocol

View File

@ -7,6 +7,7 @@ destructors dlists fry init kernel lexer make math namespaces
parser sequences sets strings threads ui.backend ui.gadgets parser sequences sets strings threads ui.backend ui.gadgets
ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser ui.gadgets.private ui.gadgets.worlds ui.gestures vocabs.parser
words ; words ;
FROM: namespaces => change-global ;
IN: ui IN: ui
<PRIVATE <PRIVATE

View File

@ -7,6 +7,7 @@ unicode.normalize.private values io.encodings.ascii
unicode.data compiler.units fry unicode.categories.syntax unicode.data compiler.units fry unicode.categories.syntax
alien.syntax sets accessors interval-maps memoize locals words alien.syntax sets accessors interval-maps memoize locals words
simple-flat-file ; simple-flat-file ;
FROM: sequences => change-nth ;
IN: unicode.breaks IN: unicode.breaks
<PRIVATE <PRIVATE

View File

@ -5,6 +5,7 @@ combinators definitions generic hashtables kernel
kernel.private layouts math namespaces quotations kernel.private layouts math namespaces quotations
sequences words generic.single.private effects make sequences words generic.single.private effects make
combinators.private ; combinators.private ;
FROM: assocs => change-at ;
IN: generic.single IN: generic.single
ERROR: no-method object generic ; ERROR: no-method object generic ;

View File

@ -229,3 +229,11 @@ M: slot-spec make-slot
: slot-named ( name specs -- spec/f ) : slot-named ( name specs -- spec/f )
slot-named* nip ; 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

View File

@ -4,6 +4,7 @@ USING: accessors arrays definitions kernel kernel.private
slots.private math namespaces sequences strings vectors sbufs slots.private math namespaces sequences strings vectors sbufs
quotations assocs hashtables sorting vocabs math.order sets quotations assocs hashtables sorting vocabs math.order sets
words.private ; words.private ;
FROM: assocs => change-at ;
IN: words IN: words
: word ( -- word ) \ word get-global ; : word ( -- word ) \ word get-global ;

View File

@ -3,6 +3,7 @@
USING: accessors assocs combinators kernel locals math USING: accessors assocs combinators kernel locals math
math.ranges memoize sequences strings hashtables math.ranges memoize sequences strings hashtables
math.parser grouping ; math.parser grouping ;
FROM: assocs => change-at ;
IN: benchmark.hashtables IN: benchmark.hashtables
MEMO: strings ( -- str ) MEMO: strings ( -- str )

View File

@ -6,6 +6,7 @@ IN: bloom-filters
FROM: math.ranges => [1,b] ; FROM: math.ranges => [1,b] ;
FROM: math.intervals => (a,b) interval-contains? ; FROM: math.intervals => (a,b) interval-contains? ;
FROM: sequences => change-nth ;
/* /*

View File

@ -2,6 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs kernel locals math math.order USING: accessors arrays assocs kernel locals math math.order
math.ranges sequences sequences.private z-algorithm ; math.ranges sequences sequences.private z-algorithm ;
FROM: sequences.private => change-nth-unsafe ;
IN: boyer-moore IN: boyer-moore
<PRIVATE <PRIVATE

View File

@ -3,6 +3,7 @@ http.client io io.encodings.ascii io.files io.files.temp kernel
locals math math.matrices math.parser math.vectors opengl locals math math.matrices math.parser math.vectors opengl
opengl.capabilities opengl.gl opengl.demo-support sequences opengl.capabilities opengl.gl opengl.demo-support sequences
splitting vectors words specialized-arrays ; splitting vectors words specialized-arrays ;
FROM: sequences => change-nth ;
QUALIFIED-WITH: alien.c-types c QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: c:float SPECIALIZED-ARRAY: c:float
SPECIALIZED-ARRAY: c:uint SPECIALIZED-ARRAY: c:uint

View File

@ -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 images.png io io.encodings.ascii io.files io.files.unique io.launcher
kernel math.parser sequences assocs arrays make math namespaces kernel math.parser sequences assocs arrays make math namespaces
quotations combinators locals words ; quotations combinators locals words ;
FROM: assocs => change-at ;
IN: compiler.graphviz IN: compiler.graphviz
: quotes ( str -- str' ) "\"" "\"" surround ; : quotes ( str -- str' ) "\"" "\"" surround ;

View File

@ -3,6 +3,7 @@ USING: accessors audio.engine combinators concurrency.promises
destructors fry game.input game.loop generic kernel math parser destructors fry game.input game.loop generic kernel math parser
sequences threads ui ui.gadgets ui.gadgets.worlds ui.gestures sequences threads ui ui.gadgets ui.gadgets.worlds ui.gestures
words words.constant ; words words.constant ;
FROM: namespaces => change-global ;
IN: game.worlds IN: game.worlds
TUPLE: game-world < world TUPLE: game-world < world

View File

@ -4,6 +4,7 @@ USING: accessors combinators kernel locals math math.combinatorics
math.polynomials opengl.gl sequences ui.gadgets ui.gadgets.panes math.polynomials opengl.gl sequences ui.gadgets ui.gadgets.panes
ui.render arrays grouping math.vectors assocs ui.render arrays grouping math.vectors assocs
ui.gestures ; ui.gestures ;
FROM: sequences => change-nth ;
IN: math.splines IN: math.splines
<PRIVATE <PRIVATE

View File

@ -5,6 +5,7 @@ USING: accessors arrays ascii assocs binary-search combinators
fry kernel locals math math.bitwise math.combinatorics fry kernel locals math math.bitwise math.combinatorics
math.order math.statistics poker.arrays random sequences math.order math.statistics poker.arrays random sequences
sequences.product splitting grouping lexer strings ; sequences.product splitting grouping lexer strings ;
FROM: sequences => change-nth ;
IN: poker IN: poker
! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with ! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with

View File

@ -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 math.primes.lists math.primes.miller-rabin math.ranges math.ratios
namespaces parser prettyprint quotations sequences sorting strings namespaces parser prettyprint quotations sequences sorting strings
unicode.case vocabs vocabs.parser words ; unicode.case vocabs vocabs.parser words ;
FROM: sequences => change-nth ;
IN: project-euler.common IN: project-euler.common
! A collection of words used by more than one Project Euler solution ! A collection of words used by more than one Project Euler solution

View File

@ -3,6 +3,7 @@
USING: accessors assocs combinators hashtables http USING: accessors assocs combinators hashtables http
http.client json.reader kernel macros namespaces sequences http.client json.reader kernel macros namespaces sequences
io.sockets.secure fry oauth urls ; io.sockets.secure fry oauth urls ;
FROM: assocs => change-at ;
IN: twitter IN: twitter
! Configuration ! Configuration

View File

@ -1,6 +1,7 @@
USING: kernel sequences namespaces make math assocs words arrays USING: kernel sequences namespaces make math assocs words arrays
tools.annotations vocabs sorting prettyprint io system tools.annotations vocabs sorting prettyprint io system
math.statistics accessors tools.time fry ; math.statistics accessors tools.time fry ;
FROM: namespaces => change-global ;
IN: wordtimer IN: wordtimer
SYMBOL: *wordtimes* SYMBOL: *wordtimes*