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

Ugens no longer support positional args #377

Closed
scottyeager opened this issue Apr 14, 2024 · 3 comments
Closed

Ugens no longer support positional args #377

scottyeager opened this issue Apr 14, 2024 · 3 comments

Comments

@scottyeager
Copy link

I upgraded from 24.1b1 to 24.3b2 and noticed that all of my ugen instantiations were broken because the ugen classes don't accept positional args anymore. Updating synthdefs using positional args for ugens is a hassle because it requires looking up the names of all arguments for each ugen to be converted to keyword args.

If support for positional args to ugens can be retained, I think that would be rather nice.

@josephine-wolf-oberholtzer
Copy link
Member

josephine-wolf-oberholtzer commented Apr 14, 2024

Honestly, I've always had the opposite problem - SynthDefs with positional arguments are opaque to me and I have to consult the documentation for every UGen to understand what argument means what in each position. The official SuperCollider docs SynthDefs give me a hard time for this very reason.

And, as the maintainer, I don't necessarily make any guarantees about the order staying stable. The fact that the keywords appear in the same order they'd appear in the binary representation of the UGen should be considered a convenient implementation detail.

So I'm not super swayed by the legibility argument. Would've swapped to keyword-only arguments years ago if it had occurred to me.

I'm sympathetic to the hassle of refactoring, so I'll think about it. But I must warn you that there's even more backwards incompatibilities coming down the pipe regardless as I'm currently re-implementing SynthDefs / UGens from the ground up. Seems easier to handle fewer, spaced-out breaking changes rather than huge bundled ones

@scottyeager
Copy link
Author

Fair enough. I think that moving to keyword only and having old code break in an obvious way is better than the potentially subtle bugs introduced by reordering args that can be used as positional.

I do agree in general about keywords being more legible. On the other hand, there's Out for example, which I always write as something like Out.ar(out_bus, [signal, signal]). Also RecordBuf and PlayBuf, where the first arg is the buffer number which I always have in a variable with a descriptive name (whereas for the rest of the args in these cases I indeed prefer keywords).

My synthdef collection in Supriya is pretty small, so it wasn't a huge inconvenience. But realizing how big a job it could have been was my main inspiration for opening this issue. I don't mind adapting to this or future API changes, though I definitely appreciate the heads up.

@josephine-wolf-oberholtzer
Copy link
Member

FWIW you can test against the upcoming changes via this PR: #378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants