[chuck-users] OOP and Style Qs, Operators
Spencer Salazar
ssalazar at CS.Princeton.EDU
Wed Mar 21 16:55:55 EDT 2007
Howdy,
On Mar 21, 2007, at 12:57 PM, Veli-Pekka Tätilä wrote:
> Hi Spencer,
> Very useful info. I'll snip a lot and only comment the stuff I have
> more
> questions or additions for.
>
>> Additionally, you can save a little time/memory by using arrays of
>> null UGen references, rather than arrays of UGens.
> Hmm isn't this a bit suspicious, in terms of semantics. I mean the
> default
> of instanciating arrays as though objects where already
> constructed. If they
> are added, that design cannot support classes that lack a
> parameterless
> constructor, singleton classes in which it is private, and abstract
> classes
> or interfaces which cannot b instanciated in the first place.
That should be okay--when constructors and abstract classes are
finally implemented in ChucK, the gotchas you mentioned can and
should be caught by the compiler.
> IS string also
> a class? I read something to that effect but cannot find its methods
> anywhere. I don't seem to be able to do much apart from
> concatenating them.
It is a class, but it doesn't have any documented methods (yet).
>>> will there be a template mechanism or the ability to
>>> downcast
>>> arguments?
>> You can always cast them to back to what they were initially, using
>> the $ operator. You just have to actually know what they are.
> Ah that's the question. Quite OK for homogenous stuff but I can
> already
> imagine a design in which this is not known. IN which I have to
> branch on a
> type name. That's a bad smell in OOPy circles often but not always.
> Many
> recursive data structure dumpers require, for example, that you
> know whether
> an element is a single item, some reference to an array or object or
> something else. Not very relevant to chucK right now, though, as
> there's no
> serialization support.
Yes, ChucK is definitely not the language for OO purists...
>> don't know yacc either, but in my experience its pretty easy to
>> pick up
>> the
>> basics by just reading a .y file.
> Ah I'll take a look. I'll be lazy and ask if there's a direct URL
> to the
> current CHucK yacc grammar. I usually don't get the source, though
> in this
> case it might be beneficial.
You'll probably have to take a look at the source, as the repository
is not online. If you have a cvs client on your machine, then
something like
cvs -d :ext:anon-chuck at cvs.cs.princeton.edu:/cvs checkout chuck_dev/
v2/chuck.y
should also do the trick. Just be sure to replace the ' at ' with an
actually 'at' sign, as I believe the list server automatically
replaces at signs with ' at ' to foil the spam bots.
spencer
>
> --
> With kind regards Veli-Pekka Tätilä (vtatila at mail.student.oulu.fi)
> Accessibility, game music, synthesizers and programming:
> http://www.student.oulu.fi/~vtatila/
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
More information about the chuck-users
mailing list