Difference between parameters and slots? / Csound

Rick Taube hkt@cmp-nxt1.music.uiuc.edu
Tue, 12 Nov 1996 19:51:49 -0600


>I have two questions, first an easy one, and then a more involved one.
>
>First, after looking over the kernel code for a while, I'm still not sure
>what the real difference is between the "note" class slots, and parameters.
>In particular, when subclassing notes, in what cases would you want slots
>that are not in the parameter list? The documentation describes parameters

it would be overly restrictive to insist that all user slots contribute a
value to the output event, even though this will be the case for many
"terminal classes". so in practice most defobjects will add slots that are
also parameters this need not be the case.

>>x/y data pairs or something similar.  So from CM's point of view, these
>parameter lists would IMO best be represented as single parameters whose
>value is a LISP list. Then, when the object is written, then the list would
>be flattened to individual output fields.

this is already supported by the &rest parameter declaration --
unfortunately, i just looked at the code and only clm-note currently makes
use of this! so until i can add this feature to csound in the next release,
you can implement a method for write-event yourself and use the
formatting-slots macro, which allows you to customize the output printing.

in the next release, ill make &rest possible in the parameter declaration
of defobject itself.

(defobject i2 (csound-note)
  (bar baz)
  (:parameters ins time &rest baz))

would print

i2 1.23 56 89 233 1223

if time was 1.23 and baz held the list (56 89 233 1223)

note that its only possible to have ONE &rest parameter. if you want to
flatten more that one list, you will have to use formatting-slots in any
event.