[squeak-dev] [ANN] Tirade
Göran Krampe
goran at krampe.se
Mon Mar 16 21:07:26 UTC 2009
Hi!
Nicolas Cellier wrote:
> Hi Goran,
> Two remarks:
>
> 1) closing the language:
>
> I know you want control and security.
Well, I want to maintain simplicity mainly. Currently it is so simple
that it is "intuitively safe". Safety is not necessarily about exploits
but rather about not inviting developers to do "smart stuff" that breaks
tools etc.
> But are you sure the language is opened enough for future deltas extensions?
Can't really see what you mean.
> I think of arbitrary method attributes for example, that might require more
> complex objects than just strings.
> Imagine for example you need to enter rich text attributes and specify RGB
> colors #(1.0 0.0 0.0)...
Well, first of all you can always fall back on String representations in
Tirade. Like say: "rgb: 'FFEA99'". The builder can always do some
interpretation of the Strings passed in.
A more obvious example are TimeStamps or Dates. We just decide on a
suitable String representation and use that.
> You could eventually enhance syntax to allow a Float literal, but not easily
> a Fraction (if ever needed...).
Allowing richer Numbers is something I discussed today on IRC. Right now
Tirade only does positive and negative Integers. I started looking at it
but realized that Number class>>readFrom: and friends are complex beasts
indeed! It is fairly obvious though that we can make Tirade either use
the logic in Squeak "straight off" or something a tad simpler/faster.
There are basically two situations I can see that makes "." in Floats
tricky:
- Mistakenly think the "." is a message final period.
- Mistakenly think the "." is a brace array separator.
The first case is actually not hard at all in Tirade because it is
impossible to have a digit *after* a message final period. In regular
Smalltalk it is not impossible though, if the next statement starts with
a literal number as receiver. In Tirade the next character must be
either whitespace, " or a letter starting a new keyword/unary message.
In a brace array (without having looked at the Squeak Parser in detail)
it seems that the parser "eagerly" parses Floats, so that a digit
followed by a "." followed by a digit turns into a Float and yet another
"." turns into a separator.
So in short - if you start using Floats in a brace array then whitespace
counts! :)
> 2) securing the language:
>
> You'll definitely have to black/white list messages...
>
> become: {'#hacker inspect'}.
> evalStrings.
This is done by the reader today, it will send #isSelectorAllowed: to
the builder and only do the perform: if it answers true. This is not
hardwired into the Parser. Same goes for the "who is the
receiver"-logic, you control this in your subclass of TiradeParser.
In other words, these two things are not defined in the Tirade
"language". :)
regards, Göran
More information about the Squeak-dev
mailing list
|