Thanks for trying it out, all of you, and all the thoughtful comments! I was kind of expecting a bit of “no, no, no, modular is finding ways to do math with circuits, not code” gatekeeping, so if those people exist, I’m glad they haven’t tried this yet 
I’m going to answer some questions and probe for more details below, but none of my thoughts are final, to be clear.
@FiroLFO
- Is elseif going to be available?
I’ve bumped into wanting this as well. I’ll investigate.
- Is there a way to check if a cable is plugged in (see isconnected())?
Like isconnected(out1) or isconnected(in1)? I’m surprised this is desirable, since I feel like the author of the code would also be the person connecting cables to it (or not). Can you describe the situation you’re thinking of a bit more?
- Any trick to include a string variable (i.e. seq1=“10101100”)?
At first glance, this looks more like an array of booleans than a string. I’m thinking about arrays (see below), but would love to know more about how you want to use them in this case.
@main.tenant
Yes, arrays are of interest. In BASIC (at least the BASIC I grew up with), one would do a DIM[10] to make an array, but I think the need for explicitly setting array sizes is firmly in the past. But here’s a divisive question: 0-indexed or 1-indexed? I think 0-based, but that requires more explanation to new programmers.
There is a mod(a, b) function, which is really doing std::fmod(). I tend to think of ‘%’ as a modulo operator for integers, and integers aren’t really a thing in BASICally. Also, approachability of the language is also of value to me (I’m assuming most VCV Rack users have never written a program), and I worry that punctuation marks are more off-putting than mod() or pow(). I like that mod(foo, 1) returns the part of foo after the decimal point.
Yeah, why BASIC? It’s not like I’ve written any since, uh, 1983-ish. Well, at first I was struck by the joy in Hainbach’s voice when he realizes that he can program a tape machine with the language of his C64 childhood. And then I thought, you know, BASIC is still very approachable, in that I suspect that you can have no experience with writing software and be able to tweak examples to do what you want. BASIC was, after all, created to introduce inexperienced students to programming. I know there are academics who wish it hadn’t been, though.
I’m not suggesting that I would want to write longer programs in this tiny subset of BASIC, but the context (inside a modular system with a tiny UI) doesn’t really lend itself to long programs anyway*. There’s plenty of environments that do code->music well (CSound, ChucK, Pure Data, live coding languages, etc.), but this doesn’t call for that, in my opinion; this is, like Perl and AWK, more of a glue language, enabling other modules to work together in a novel manner. Or at least a gesture in that direction.
But I’d be fascinated if someone else decided to cram some significant portion of Lua in Rack. And, well, I think one could slap a different parser on it and generate the same PCode from a pseudo-Python or what have you. I just didn’t feel like explaining Python indentation in the docs.
More IN’s and OUT’s: I quickly noticed the need for more INs myself, so the current version of the module in development has 6 INs and 4 OUTs.
I’ve been considering pushing the edit window to the right enough to add another column of ports, which is probably enough for ~seven more ports. I’ve been thinking that 11 INs and 4 OUTs
would be pretty good (with room for a couple more controls).
Thoughts?
Have you found yourself needing more OUTs in particular? That (so far) is less compelling to me.
I personally dislike expanders, as they seem terribly undiscoverable to me (I’ve been using Rack for a year and only recently heard of them).
@k-chaffin I think this “restart” behavior is a really good thing to point out. Since I’ve been thinking that one-time-per run code could go into an “ON RUN…END ON” block as well (in part so they don’t get run every sample), I need to think more on how to make this essentially a pseudo-multithreaded system, and how these ON blocks might interact.
There is no set limit to how deep FOR-NEXT loops can nest. But do bear in mind the slightly surprising detail about FOR loops.
Arrays, yes, I agree…
Thank you for the kind words. It feels like I’ve spent more time on the editor than on the compiler. I wish I had gone ahead and started with making my own version of TextField instead of subclassing it for as long as I did. The next version will have simple scrolling, which I think you’ll all like.
@DaveVenom I know what you mean about some knobs, but then I feel like every time I see a knob I think, wait, what if I want to modulate it? I’m kind of frustrated that I can’t find a thin module with knobs/outputs/renamable labels, so I could just put it next to BASICally and hook them in. PatchMaster is almost there. So is MentalKnobs. So I’m torn.
Polyphony is really deep, as you describe. I’d love to have some use cases from you in the form of code and desired results to ponder over, since it’s something I never use.
Make the editor disappear entirely; that seems very doable. Smaller STYLE knob is a good point.
As you can see from the screenshot above, the Good/Fix area will be different in the next version. But flashing is pretty distracting to me, so I’m disinclined to do that. I think the fact that the word changes (from Good to Fix) is helpful. I tried looking at the indicator via Edge’s color-blindness simulators, and while the difference is present, I’ll tweak the color and text shades a bit to clarify that they are different states.
Thanks again for sharing your experiences.
mahlen
*That said, I recall hearing that the authors of AWK were taken aback the first time they saw a 200-line AWK program.