Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of Class.initClassTree(ControlSpec) can remove common mappings #2318

Closed
antonhornquist opened this issue Sep 3, 2016 · 6 comments
Closed
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library
Milestone

Comments

@antonhornquist
Copy link
Contributor

antonhornquist commented Sep 3, 2016

I used this in the *initClass of a custom class:

Class.initClassTree(ControlSpec)

Afterwards I could note that the common mappings (\unipolar, \bipolar, \freq, etc) defined in ControlSpec.initClass were not available anymore when I compiled the class in 3.7.2. In 3.6.6 they still showed up.

I'm quite sure this is due to the fact that Spec.initClass is not invoked prior to ControlSpec.initClass so the common mappings are overwritten after they have been added, in the cases when Spec is inited after ControlSpec.

I think simply adding Class.initClassTree(Spec) to the top of ControlSpec.initClass would fix this problem.

@crucialfelix
Copy link
Member

If your custom class requires those specs then it should call
initClassTree(ControlSpec)

There is no guarantee what exact order classes are initialized. That's why
initClassTree allows you to ensure a class is initialized. When you add new
classes then the order may change.

So the problem is not because controlspec or spec isn't doing something,
it's that you need them initialized so you need to request that they are
initialized before you use them.

Does that explain it ?

On Sat, Sep 3, 2016, 16:35 Anton Hörnquist notifications@github.com wrote:

I used this in the *initClass of a custom class:

Afterwards I could note that the common mappings (\unipolar, \bipolar, \freq, etc) defined in ControlSpec.initClass were not available anymore when I compiled the class in 3.7.2. In 3.6.6 they still showed up.

I'm quite sure this is due to the fact that Spec.initClass is not invoked prior to ControlSpec.initClass so the common mappings are overwritten afterwards when Spec is inited.

So I think simply adding Class.initClassTree(ControlSpec) to the top of ControlSpec.initClass would fix this problem.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2318, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AANWcpzlZN-TJNuc353ngqHlX4RpSmdbks5qmYWUgaJpZM4J0ULb
.

@antonhornquist
Copy link
Contributor Author

Sorry if I was unclear. I am using Class.initClassTree(ControlSpec) in my custom class. It causes common mappings to disappear.

Since ControlSpec.initClass does not invoke Class.initClassTree(Spec) the common specs are overwritten when Spec.initClass - by the core SuperCollider init functionality - is invoked after ControlSpec.initClass. In my 3.7.2 SC this is the case. In 3.6.6 it's not the case.

This is a bug. The dictionary in Spec.initClass must be created before ControlSpec fills it. I can fix this in my app by initing Spec before ControlSpec explicitly myself, but I think this should be fixed in core lib. I propose to include Class.initClassTree(Spec) in ControlSpec.initClass.

I can create a pull request for this oneliner.

@antonhornquist
Copy link
Contributor Author

Please also note that I revised the initial issue report just after posting it, it included a mixup of ControlSpec and Spec. It is probably clear if you reread it.

@crucialfelix
Copy link
Member

OK, I see what you mean now.

nB: yes I noticed your error (that you later edited). If you actually did call Class.initClassTree(ControlSpec) it might cause the app to crash because it keeps calling it again and again. Hopefully it flags it as already-inited before calling.

@crucialfelix crucialfelix added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library labels Sep 4, 2016
@crucialfelix crucialfelix added this to the 3.8 milestone Sep 4, 2016
@jamshark70
Copy link
Contributor

Hopefully it flags it as already-inited before calling.

It does -- see the usage of classesInited in initClassTree.

@crucialfelix
Copy link
Member

Yes, I know I wrote it. I'm just wondering (while on my telephone, out and
about wandering the earth) if I did actually do it right.

On Mon, Sep 5, 2016 at 12:41 AM jamshark70 notifications@github.com wrote:

Hopefully it flags it as already-inited before calling.

It does -- see the usage of classesInited in initClassTree.


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#2318 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANWcuSETDHJfChEvj75a2BeWHCR3we_ks5qm0kFgaJpZM4J0ULb
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. comp: class library SC class library
Projects
None yet
Development

No branches or pull requests

3 participants