hi. I'm facing a weird issue with inheritance. here is a bit of code : http://pastebin.com/rGFx6pus I have a Handler class that defines a listen() method, and several classes inheriting from Handler. Then, when I try to call bpm.listen(orec) on line 10, it says "class BpmHandler has no member listen" - even though it should access the one from the Handler class. Any clue ? And by the way, I was wondering: Handler @ h; new BpmHandler @=> h; this won't work, even though it is legit from a OOP inheritance point of view. is it deliberate, or something on the todo list of the dev team ? cheers tom
Hi Thomas,
try putting the definitions for Handler and all classes that inherit from it on top of the file, then define OscInterface.
--- On Thu, 7/10/10, Thomas Girod
Thanks, it did the trick ! and about the other thing, looks like it was a mistake after all. tom On Thu, Oct 07, 2010 at 03:26:47PM +0100, Andreas Apergis wrote:
Hi Thomas,
try putting the definitions for Handler and all classes that inherit from it on top of the file, then define OscInterface.
--- On Thu, 7/10/10, Thomas Girod
wrote: From: Thomas Girod
Subject: [chuck-users] broken inheritance ? To: "Chuck Users" Date: Thursday, 7 October, 2010, 16:37 hi.
I'm facing a weird issue with inheritance. here is a bit of code : http://pastebin.com/rGFx6pus
I have a Handler class that defines a listen() method, and several classes inheriting from Handler.
Then, when I try to call bpm.listen(orec) on line 10, it says "class BpmHandler has no member listen" - even though it should access the one from the Handler class. Any clue ?
And by the way, I was wondering:
Handler @ h; new BpmHandler @=> h;
this won't work, even though it is legit from a OOP inheritance point of view. is it deliberate, or something on the todo list of the dev team ?
cheers
tom
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
On 7 October 2010 21:46, Thomas Girod
Thanks, it did the trick ! and about the other thing, looks like it was a mistake after all.
IMHO it's ChucK that's wrong, not you. As I read the documentation and from what we are able to deduct from the way that functions work classes should be able to be defined anywhere in the file that we feel is the most convenient or natural place with the parser sorting it out, then complaining if something is really wrong (circular inheritance or whatever). That doesn't do you much good now as you need to work with the VM that we have and not with some platonic reflection of the specifications, but I still wanted to point that out; Wherever possible it's much better to blame ChucK than it is to blame yourself. Blaming yourself just makes you sad while loudly blaming ChucK will hopefully lead to a better ChucK and everyone will be much happier ;¬). Kas.
Oh, and those lines work fine for me:
Handler @ h;
new BpmHandler @=> h;
OscRecv or;
h.listen( or );
I'm on Mac 10.4.11
Cheers
--- On Thu, 7/10/10, Thomas Girod
participants (3)
-
Andreas Apergis
-
Kassen
-
Thomas Girod