[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] SuperCollider code syntax
On December 31, 2015 8:15:16 AM Bob Lee <bob@xxxxxxxxxxxxxxxxxxx> wrote:
Having recently discovered SuperCollider and subscribed to this list, I'm
encouraged by the amount of activity. I am an experienced programmer (and
a musician). I'm a bit baffled by the language, though. It looks a lot
like C++ or Java, but not quite.
Is it a known programming language, independent of SC?
It's a domain specific language of its own. Its design is rooted in
SmallTalk but the syntax mimics C in many ways.
If not, is there a
syntax document that enumerates the operators, reserved words, etc.?
SC doesn't have operators or reserved words in the sense that you might assume.
- "Reserved words" are class and method names. (Technically, there are a
few reserved variable names that access language internals: this,
thisThread, currentEnvironment and a few others. They are a bit exotic,
though. The main language functionality is fully contained in class
definitions.)
- "No reserved words" extends to control structures as well -- if, do,
while, case, switch, for etc. are all implemented as methods. The SC
bytecode compiler optimizes some of these (particularly branching
structures) by inlining the instructions when possible, but you can still
find "while" as a method of Function, for instance.
- Guess what... No operators, either. Instead, SC has methods named by a
specific set of punctuation marks. The compiler uses infix syntax for
these: a + b translates to "call '+' on a, with b as argument."
All that means, SC's syntax is simpler than most languages. *Using* it
requires getting exposed to the class library, bit by bit.
hjh
Sent with AquaMail for Android
http://www.aqua-mail.com
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/