Skip to content

Commit

Permalink
slots: pre-create the "at", "nth", and "global" slots to make determi…
Browse files Browse the repository at this point in the history
…nistic the currently nondeterministic ambiguity between accessors:change-* and assocs:change-at, sequences:change-nth, and namespaces:change-global
  • Loading branch information
jckarter committed Sep 19, 2011
1 parent e624205 commit 571ef86
Show file tree
Hide file tree
Showing 39 changed files with 49 additions and 3 deletions.
1 change: 1 addition & 0 deletions basis/bit-arrays/bit-arrays.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/checksums/md5/md5.factor
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions basis/compiler/cfg/dce/dce.factor
Expand Up @@ -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

Expand Down
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/compiler/cfg/linear-scan/linear-scan.factor
Expand Up @@ -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:
Expand Down
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions basis/compiler/cfg/ssa/construction/construction.factor
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions basis/compiler/cfg/ssa/construction/tdmsc/tdmsc.factor
Expand Up @@ -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
Expand Down
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions basis/core-foundation/fsevents/fsevents.factor
Expand Up @@ -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*
Expand Down
1 change: 1 addition & 0 deletions basis/disjoint-sets/disjoint-sets.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/documents/documents.factor
Expand Up @@ -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 ;
Expand Down
1 change: 1 addition & 0 deletions basis/game/input/dinput/dinput.factor
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions 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 ;
Expand Down
1 change: 1 addition & 0 deletions basis/game/input/iokit/iokit.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/gobject-introspection/gobject-introspection.factor
Expand Up @@ -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 ;
Expand Down
1 change: 1 addition & 0 deletions basis/persistent/vectors/vectors.factor
Expand Up @@ -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

<PRIVATE
Expand Down
1 change: 1 addition & 0 deletions basis/random/sfmt/sfmt.factor
Expand Up @@ -4,6 +4,7 @@ USING: accessors alien.c-types alien.data kernel locals math
math.ranges math.bitwise math.vectors math.vectors.simd random
sequences specialized-arrays sequences.private classes.struct
combinators.short-circuit fry ;
FROM: sequences => change-nth ;
SPECIALIZED-ARRAY: uint
SPECIALIZED-ARRAY: uint-4
IN: random.sfmt
Expand Down
1 change: 1 addition & 0 deletions 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 } ;
Expand Down
1 change: 1 addition & 0 deletions basis/threads/threads.factor
Expand Up @@ -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

<PRIVATE
Expand Down
2 changes: 2 additions & 0 deletions basis/tools/deploy/shaker/shaker.factor
Expand Up @@ -22,7 +22,9 @@ QUALIFIED: source-files
QUALIFIED: source-files.errors
QUALIFIED: vocabs
QUALIFIED: vocabs.loader
FROM: assocs => change-at ;
FROM: namespaces => set ;
FROM: sequences => change-nth ;
FROM: sets => members ;
IN: tools.deploy.shaker

Expand Down
2 changes: 1 addition & 1 deletion basis/ui/backend/windows/windows.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/ui/gadgets/tables/tables.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions basis/ui/ui.factor
Expand Up @@ -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

<PRIVATE
Expand Down
1 change: 1 addition & 0 deletions basis/unicode/breaks/breaks.factor
Expand Up @@ -7,6 +7,7 @@ unicode.normalize.private values io.encodings.ascii
unicode.data compiler.units fry unicode.categories.syntax
alien.syntax sets accessors interval-maps memoize locals words
simple-flat-file ;
FROM: sequences => change-nth ;
IN: unicode.breaks

<PRIVATE
Expand Down
1 change: 1 addition & 0 deletions core/generic/single/single.factor
Expand Up @@ -5,6 +5,7 @@ combinators definitions generic hashtables kernel
kernel.private layouts math namespaces quotations
sequences words generic.single.private effects make
combinators.private ;
FROM: assocs => change-at ;
IN: generic.single

ERROR: no-method object generic ;
Expand Down
8 changes: 8 additions & 0 deletions core/slots/slots.factor
Expand Up @@ -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
1 change: 1 addition & 0 deletions core/words/words.factor
Expand Up @@ -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 ;
Expand Down
3 changes: 2 additions & 1 deletion extra/benchmark/hashtables/hashtables.factor
Expand Up @@ -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 )
Expand Down Expand Up @@ -72,4 +73,4 @@ M: collision hashcode* value>> hashcode* 15 bitand ;
] times
drop ;

MAIN: hashtable-benchmark
MAIN: hashtable-benchmark
1 change: 1 addition & 0 deletions extra/bloom-filters/bloom-filters.factor
Expand Up @@ -6,6 +6,7 @@ IN: bloom-filters

FROM: math.ranges => [1,b] ;
FROM: math.intervals => (a,b) interval-contains? ;
FROM: sequences => change-nth ;

/*

Expand Down
1 change: 1 addition & 0 deletions extra/boyer-moore/boyer-moore.factor
Expand Up @@ -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

<PRIVATE
Expand Down
1 change: 1 addition & 0 deletions extra/bunny/model/model.factor
Expand Up @@ -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
opengl.capabilities opengl.gl opengl.demo-support sequences
splitting vectors words specialized-arrays ;
FROM: sequences => change-nth ;
QUALIFIED-WITH: alien.c-types c
SPECIALIZED-ARRAY: c:float
SPECIALIZED-ARRAY: c:uint
Expand Down
3 changes: 2 additions & 1 deletion extra/compiler/graphviz/graphviz.factor
Expand Up @@ -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 ;
Expand Down Expand Up @@ -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 ;
render-graph ;
1 change: 1 addition & 0 deletions extra/game/worlds/worlds.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions extra/math/splines/splines.factor
Expand Up @@ -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

<PRIVATE
Expand Down
1 change: 1 addition & 0 deletions extra/poker/poker.factor
Expand Up @@ -5,6 +5,7 @@ USING: accessors arrays ascii assocs binary-search combinators
fry kernel locals math math.bitwise math.combinatorics
math.order math.statistics poker.arrays random sequences
sequences.product splitting grouping lexer strings ;
FROM: sequences => change-nth ;
IN: poker

! The algorithm used is based on Cactus Kev's Poker Hand Evaluator with
Expand Down
1 change: 1 addition & 0 deletions extra/project-euler/common/common.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions extra/twitter/twitter.factor
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions 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*
Expand Down

0 comments on commit 571ef86

Please sign in to comment.