Re: [livecode] Code Design: environment vars vs. dictionary approach

From: Dan S <danstowell+toplap_at_gmail.com>
Date: Fri, 14 Feb 2014 10:57:45 +0000

Hi Jonas,

Those two approaches are very very similar, really. The biggest
difference is the typing you have to do at first to get things set up,
but that's not very important - more important is the things you'll
have to type again and again during the performance. So maybe it
depends on where your "~" key is on your keyboard ;)

I do tend to use "global" vars quite a lot, but it's not a great
habit. Firstly because it's easy for me to keep using "x" and
accidentally overwrite "x" so I can't access a running synth any more
(the previous "x"), doh. It's great for quickly coding up ideas to
have these one-character variables, but it's not very mnemonic, and in
general it's a bit better for my own thinking (and probably better for
any readers in the audience) if I use arbitrary names like ~fee =
HPF.ar(~chh * ~sproing, ~gerpenv).

Dan


2014-02-14 10:14 GMT+00:00 Jonas Hummel <news_at_jonashummel.de>:
> Hi all,
>
> I am not a fluent SC coder and still pick up a lot from what other people do
> out there or what's to be found on sccode.org.
>
> In a recent project I found myself again wondering on the question of how to
> design the variables for values and functions. So I thought that this
> community may have some good answers on what actually differences,
> advantages or problems of using environment variables (~myvar1 = ... ) vs. a
> dictionary approach (q=(); q.myvar1 = ...) are.
>
> And for live coding purposes: Do you use global vars a lot (x = ...) ?
> or better not because they are limited in number?
>
> I don't have any concrete examples as this is rather a general design
> decision.
> Thanks for your comments!
>
> cheers
>
>
> Jonas
>
Received on Fri Feb 14 2014 - 10:58:24 GMT

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:23 BST