New features
Brian Rice
water at tunes.org
Wed Apr 13 12:32:01 PDT 2005
I've uploaded alpha images and updated the repository with more
features:
The "here" method, returning the current namespace dynamically as
discussed.
Currying, which has actually been in the image for a while, provides
methods <-, <-1, <-2, ... <-* to eliminate the Nth argument (* for
last) of the block given on the left, filling it with the value of the
right argument. It returns a new block. Right now, this is unoptimized,
but that should be fixed shortly with a byte-code compiler extension.
`cache/cacheAs: takes an expression and expands the surrounding block
so that there is an extra variable (you can optionally name it with a
symbol or string) that stores the value of evaluating it /once/. If the
variable name is given (with `cacheAs:), you can refer to that variable
later in the method and it should compile correctly. If you don't give
a name (with `cache), then equivalent expressions later in that same
lexical scope will be replaced with accesses of that variable.
addVariable&name:/addInputVariable&name: act on a block's source tree
to add new variables, defaulting to an auto-generated 'xN' name. You
can also specify another &prefix optionally. These are not macros,
however; they just return the new syntax variable object.
Sequence methods: concatenateAll:, concatenateAll:separatedBy: to join
sequences together, or with a separator sequence. chainPairsDo: is like
pairsDo: but the block is applied to each element twice, once as next
argument, then as the first (except for the first and last elements, of
course).
String methods: split&separators:, toCamelCase, fromCamelCase. split
just adds a default of whitespace separation to the sequence
splitWithAny: method. The camel case methods are currently pretty
simple, just taking words and joining/splitting them and doing the
right thing to get from one naming style to another. They do take
optional separator arguments, so underscores vs. dashes vs. spaces may
be used. They are limited right now in that they assume everything's
lowercase by default.
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/
More information about the Slate
mailing list