[chuck-users] what is the syntax for casting an array of objects?
Robert Poor
rdpoor at gmail.com
Sat Mar 20 02:12:23 EDT 2010
I'm getting a message:
> [babble_patch.ck]:line(142): arguments type(s) do not match:
[babble_patch.ck]:line(142): ... for function
> 'PatchableObserver.attach_all(...)' ...
[babble_patch.ck]:line(142): ...(please check the argument types)
The line in question in file babble_patch.ck:line(142):
> PatchableObserver.attach_all(_handlers);
The declaration of _handlers in babble_patch.ck:line(76):
> Handler @ _handlers[];
The declaration of the Handler class in babble_patch.ck:line(37):
> class Handler extends PatchableObserver { ... }
And the declaration of attach_all in patchable_observer.ck:line(16):
> fun static void attach_all(PatchableObserver ps[]) { ... }
What I *intend* is to pass an array of Handler objects to attach_all(). I
can imagine that ChucK is concerned that Handler isn't the same as
PatchableObject (don't laugh at me -- I've gotten used to Ruby's duck
typing).
But I can't figure out the syntax for casting an array of Handler[] as an
array of PatchableObject[] to pass to attach_all(). Any ideas?
[If need be I can make a smaller self-contained example. But my hope is that
this is some easily answered question.]
Thanks in advance,
- Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100319/3be1265f/attachment.html>
More information about the chuck-users
mailing list