General copied/pasted code errors

Brilliant! I have been imagining for some time how I can contribute to the development of this wonderful community given my limited abilities, so I love knowing that in some way this can be of some use :))

For what it’s worth, I’ve also noticed the following behavior:

  1. Start supercollider (without booting the server)
  2. Run “conflicting code” (valid code that produces unjustified errors)
  3. Observe that the code has been interpreted happily (although, obviously, the audio is not heard)

  1. Start the server
  2. Run the “conflicting code” again
  3. The error now occurs

1 Like

By the way, I have uninstalled my antivirus client, disabled Windows Defender and manually added exceptions in the Windows firewall for sclang.exe, scsynth.exe, scide.exe and supernova.exe, but this does not solve the problem either

@prko opened a new issue on GitHub to track the problem.

avdrd found a fix for this issue here, but it still persists.

Sorry for the double post.

The file TextLexerBrutal.sc states that

// whether or not to include ^ in any alphabets. Can’t do it right now,
// because ^ will cause unwanted early termination when interpreted.

I think that the issues mentioned earlier are likely due to such an ‘early termination’.

In my user folder, I found a file, editor.js, that could be related to the problem.

“Early termination” refers to:

+ Collection {
    myMethod { |sentinel, func|
        this.do { |item|
            if(func.value(item, sentinel)) {
                ^item  // here is early termination of the loop
            }
        };
        ^nil
    }
}

That is, ^ behaves this way in a SC class definition. This meaning of ^ is specific to sclang code and should not be assumed to be the same for computer languages in general.

In a string, ^ is just a character, nothing special about it.

The problem in this thread is all taking place in C++, which uses the keyword return to early-exit a function. In C++, there’s no early termination associated with ^.

Interesting that it’s booting the server that messes up the IPC. Those should be independent: IPC is IDE ↔ sclang, booting the server is sclang ↔ server. When the server is running, the IDE does send its own /status requests directly to the server, but that’s through a network socket, which also shouldn’t affect IPC.

hjh

1 Like

Someone who encounters this should get a debug build up and trace the data flow in a debugger. I believe text goes out here: https://github.com/supercollider/supercollider/blob/a0644a73788516e406bf1ceebc1f0f6a950e333e/editors/sc-ide/core/sc_process.cpp#L212

and comes in here: https://github.com/supercollider/supercollider/blob/a0644a73788516e406bf1ceebc1f0f6a950e333e/lang/LangSource/SC_TerminalClient.cpp#L317

Although I’m less certain on the language client side.