BASICally: a new module for writing code within Rack

Note: following question is not a hidden feature request. It is only a question. I’m curious.

@StochasticTelegraph There isn’t any way to loop through the sockets by a ‘for’ loop, is there?

Just to show a simplified example what I mean:

for i=0 to 5
  out1+i=nx[random(0,9)]
next

(Thank you for the not-a-request note.)

No, there is not.

And there’s a perhaps unwelcome surprise in your shorter for-loop version, in that a NEXT has a implied WAIT 0 in it, meaning that the for-loop version would only update, say, out1, every six samples, whereas the flat version will update every sample. Depending on desired outcome, that might be an issue.

I put in the implied WAIT 0 into loops because I didn’t want to make it too easy to stall or stutter Rack by naively taking a long time while iterating over a For loop. But it’s non-obvious at times.

1 Like

Chances for ‘functionnal programming’ in roadmap?

If you mean a true functional language, like a Haskell, Erlang, Scheme, or LISP, mmmm, that would certainly be a different module, and, I would currently expect, one with a far smaller potential audience. But I’d be curious what an example or two of that would look like, in your imagining.

If you instead mean being able to define and then call functions, that seems a lot more tractable, and I’ve certainly encountered the desire for that myself. I don’t relish the thought of trying to explain and document variable name spaces and countless other issues functions could introduce, but functions sure would be nice sometimes…

Javascript is a perfectly usable functional language, isn’t it? Aren’t there any JS modules for VCV? Or was that only in some never updated module?

Are you thinking of this?

It looks like this was less an attempt to surface JS to the user and more to use it within the module’s code?

1 Like

Yeah, I was thinking more of this:

2 Likes

Yeah - I’ve never understood why that has not been ported to V2. A lot can be done with docB Formula One and BASICally, but VCV Prototype had some nice features that I miss. In particular was the ability to format and display multi-line text.

2 Likes

:+1:‍‍

Absent any actual information on motivations, I can imagine a few reasons:

  • This paragraph in the docs gave me pause: “When opening a patch containing a VCV Prototype script, a security warning is displayed before it runs. Only load scripts from patch artists you trust. *Running Prototype scripts from untrusted sources may compromise your computer and personal information.” Yeah, running any random schmoe’s code is a vast security hole. No amount of, “well, you clicked OK” would untarnish VCV’s reputation as “VCV hacked my laptop!”
  • Similarly, I would think that fatal bugs in client code (like divide by zero) would be impossible to protect against. “VCV crashes randomly” is another reputation hit you don’t want. Admittedly, this can happen with modules too, but that code is to some extent reviewed by VCV, I believe.
  • Even less serious bugs stop Prototype’s process engine, implying “VCV can’t be used onstage, it will stop making the right sounds.” While creating BASICally, I realized that halting runtime errors had to be eliminated from the language, even though it makes the language be pretty odd.
  • While I love being catered to, I suspect the audience for Prototype was, eh, not huge?

Again, this is just me speculating from afar.

Not used ‘prototype’,but seriously,good idea module

Lua jit,VUlt,Faust,Super Collider

I’m going to bet your are wrong on this. Shall we say $5?

Well, @Squinky, you’re far closer to the source of these decisions than I am, so I’d imagine you are far more knowledgeable than I on this point. So while I love wagering on beliefs, I’m not convinced this is an equal knowledge bet. I would not be at all surprised to be mistaken. Note my business card from my previous job:

Also, given that this question has been raised a few times with no answer from the Rack gods, I’m also concerned that it’ll never be answered, so the wager would remain in limbo, unsatisfyingly.

If you have theories as to why Prototype has never been ported to 2.0, I’m all ears. Alternatively, if you can get an answer as to why, that would even more interesting. I can certainly imagine other reasons myself!

3 Likes

oh, I got no idea - I just didn’t think those theories sounded plausible. Anyway, I have no “inside info” on this :wink:

fwiw, last time I remember having a business card I think I was “part of the magic” :wink:

Seriously,‘Stoc’,add “function”…

Decomposing a code with functions is the minimal habit now

Easier…more logic

‘Reference’ could also be very very nice

I’have used AUTO IT…Very nice dialect

Blitz3D…Nice…

The ‘reference manual’ of this 2 dialects are top notch

100% perfect syntax files.

RJtexted is a really good “IDE”?

And the Blitz3D portable compiler wrapper…Written in AutoIt…2 ways for STD_OUT

And the source

I don’t want to go on specifics forum,so maybe with random,files will be shared

@ StochasticTelegraph , Is there a way to save/memorize the variables? Or are you considering an “Export variables to TXT” feature in the context menu in version 2.2.99? :slight_smile:

Use case: let’s say I have a pretty CV pattern generated by BASICally and I’d like to use that one again. (See example below.) Ctrl-C doesn’t help so currently I send the CV to another module and record it there.

' this is the pattern creation 
if in9>2 or start() then
 for i=0 to 255
  volt1[i]=random(0,10)
 next
 pos=-1
end if

' calculating the next step
pos=pos+1

' sending out the first eight of the voltages
out1=volt1[mod(pos,8)]

I have thought a bunch about “saving variables”, so it’s interesting to hear your confirm its utility.

Q: are you trying to save the pattern for use later in the playing of this patch, or do you want it to be available the next time you start the patch? In other words, does the data need to survive patch restarts?

Q: Is the data small (series of CV) or large (10 second audio sample)?

Q: once it’s saved somewhere, for some length of time, how do you want to refer to it? We typically refer to files by string names; I wouldn’t mind avoiding adding strings to the language, but are strings the obvious choice here? If you were, say, saving CV sequences for automatic playback later, then maybe string names aren’t helpful?

Thoughts?

Naming things is incredibly important for conveying what the thing is. Especially important when you set something aside for a while and come back later. So, I’d say “strings” (i.e. names) are important.

I remember when some implementations BASIC allowed only one or two-letter variable names, which made it much harder to understand a program.

My mother once inherited a Fortran program. It had a single variable, called “a”. “a” was an array, and each index was used for something different. nice!

2 Likes

In early versions of FORTRAN you had to represent every data structure imaginable as an array, because that’s all you had for structuring data. People got very creative, and many interesting efficient encoding techniques were invented to work within the limits of arrays.

1 Like