[Sc-devel] [commit] made dictionary safer for pseudo methods
James Harkins
jamshark70 at gmail.com
Sat Oct 6 16:42:06 PDT 2007
So, fyi, this messed up the *composite method in my ProtoEvent class.
It is entirely legitimate to add a play function to an Event, but
this change throws a warning for that too.
So I changed my method to use .put(\play, { ... }) instead, but this
might bite someone else on the ass. (Unless I'm the only person who
ever uses custom event prototypes).
hjh
On Sep 28, 2007, at 11:41 AM, Julian Rohrhuber wrote:
> I've added a long-discussed check that warns if one tries to add a
> pseudo-method in a Dictionary that already exists.
>
> a = ();
> a.isPlaying = true;
>
> this will of course not avoid any values set directly via "put". It
> makes setting a value via pseudo method a little slower, but it can
> be really hard to find errors that are caused by a later change of
> the standard methods of object, e.g., and I think this outweighs
> the little extra calculation.
>
> doesNotUnderstand { arg selector ... args;
> var func;
> if (know) {
>
> func = this[selector];
> if (func.notNil) {
> ^func.functionPerformList(\value, this, args);
> };
>
> if (selector.isSetter) {
> selector = selector.asGetter;
> if(this.respondsTo(selector)) {
> warn(selector.asCompileString
> + "exists a method name, so you can't use it as pseudo-method.")
> };
> ^this[selector] = args[0];
> };
> func = this[\forward];
> if (func.notNil) {
> ^func.functionPerformList(\value, this, selector, args);
> };
> ^nil
> };
> ^this.superPerformList(\doesNotUnderstand, selector, args);
> }
>
> --
>
>
>
>
>
> .
> _______________________________________________
> Sc-devel mailing list
> Sc-devel at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
: H. James Harkins
: jamshark70 at dewdrop-world.net
: http://www.dewdrop-world.net
.::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..:
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.create.ucsb.edu/pipermail/sc-devel/attachments/20071006/32f71fe1/attachment-0001.htm
More information about the Sc-devel
mailing list