[Pharo-project] Our response to JS proxy API + Cog regression
siguctua at gmail.com
Wed Feb 2 23:39:45 CET 2011
On 2 February 2011 23:25, Fernando Olivero <fernando.olivero at usi.ch> wrote:
> Just by curiosity, is there a problem that could be tackled using the
> StratificationProxy that cant be solved nowadays in Pharo?
Any problem where you usually using proxies.
These proxies just make sure that nothing can go past handler unnoticed.
> At least one example of usage would be interesting to learn.
Well, i had need such proxies once to provide a syntactic sugar for
lambdas could be built directly using message sends, i.e.:
lambda foo: bar.
are turned into instance of Lambda( receiver=lambda , selector = #foo:
, arguments = #(bar))
now everything works fine, if lambda does not implements #foo:
message, and therefore by sending it,
it intercepts this message in own DNU handler and creates a new lambda
which encapsulating a message send and its argument(s).
But when message is implemented by Lambda itself, things become less
simple and more tedious, because i need to initialize Lambda fields
manually, i.e. instead of writing:
newLambda := lambda at: 1.
i need to write:
newLambda := Lambda receiver: lambda selector: #at: arguments: #(1).
but using the proxy i can write it like following:
newLambda := lambda pure at: 1.
where #pure means that message send which will follow given message is
guaranteed to be captured as LMS instead of
being invoked normally.
Igor Stasenko AKA sig.
More information about the Pharo-project