supercollider / supercollider

An audio server, programming language, and IDE for sound synthesis and algorithmic composition.
http://supercollider.github.io
GNU General Public License v3.0
5.5k stars 747 forks source link

When compiling directory got `Expected ':' or {. got token: '.'` in `Quarks.clear;` #6277

Closed zmrocze closed 6 months ago

zmrocze commented 6 months ago

Environment

Steps to reproduce

I'm calling sclang on an .sc script that is supposed to install a quark.

The script is install.sc file as follows:

Quarks.clear;
Quarks.install("/nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt");
thisProcess.recompile();

Expected vs. actual behavior

but it fails already on the first line with:

$ sclang /nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt/install.sc
compiling class library...
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
    Found 867 primitives.
    Compiling directory '/nix/store/29kpkir88jk83ihpk42afn81vnzj6p4j-supercollider-with-plugins-3.13.0/share/SuperCollider/SCClassLibrary'
    Compiling directory '/nix/store/29kpkir88jk83ihpk42afn81vnzj6p4j-supercollider-with-plugins-3.13.0/share/SuperCollider/Extensions'
    Compiling directory '/home/zmrocze/.local/share/SuperCollider/Extensions'
    numentries = 1282699 / 19591926 = 0.065
    5793 method selectors, 3382 classes
    method table size 20776488 bytes, big table size 156735408
    Number of Symbols 15087
    Byte Code Size 451446
    compiled 554 files in 0.27 seconds

Info: 4 methods are currently overwritten by extensions. To see which, execute:
MethodOverride.printAll

compile done
localhost : setting clientID to 0.
internal : setting clientID to 0.
Couldn't set realtime scheduling priority 1: Operation not permitted
Class tree inited in 0.01 seconds

*** Welcome to SuperCollider 3.13.0. *** For help type ctrl-c ctrl-h (Emacs) or :SChelp (vim) or ctrl-U (sced/gedit).
Couldn't set realtime scheduling priority 1: Operation not permitted
Installing h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt
Adding path: /nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt
h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt installed
compiling class library...
    Found 867 primitives.
    Compiling directory '/nix/store/29kpkir88jk83ihpk42afn81vnzj6p4j-supercollider-with-plugins-3.13.0/share/SuperCollider/SCClassLibrary'
    Compiling directory '/nix/store/29kpkir88jk83ihpk42afn81vnzj6p4j-supercollider-with-plugins-3.13.0/share/SuperCollider/Extensions'
    Compiling directory '/home/zmrocze/.local/share/SuperCollider/Extensions'
    Compiling directory '/nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt'
Expected ':' or {.  got token: '.' 46
  in file '/nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt/install.sc'
  line 1 char 7:

  Quarks.clear;
        ^
  Quarks.install("/nix/store/h1dnyddp6x1kjg5f37k5bb28plszbr7z-SuperDirt");
-----------------------------------

Additional context

I'll admit I'm in the woods here with supercollider as I haven't used it at all. Supercollider with a superdirt plugin is a runtime dependency to TidalCycles. The above is supposed to be an installation script for superdirt. The script is provided in the form of a nix package, but it looks broken and I'm trying to fix it in that pr.

zmrocze commented 6 months ago

I think I get the error now. When I call sclang on a file, it is not the same as interpreting the file line by line inside sclang repl. How is it interpreted then? And how do I call sclang and immedietely interpret a script file inside? I've tried sclang <<< my-file.sc but it doesn't work.

cdbzb commented 6 months ago

there is a distinction between .sc files which contain Class definitions which are compiled and .scd files which are interpreted interactively. The problem you have here is that sclang is trying to compile your install script which is actually interactive code. simply changing the extension to .scd should fix this. closing this issue.