Feedback on a typing design (patterns library)


#1

Hi there,

I have started playing with design ideas about porting part of SuperCollider’s pattern library to Scala. For those not familiar with it, it is a sort of stream/iterator processing, but in a dynamically typed language, allowing you to do wild things and mix different types. So I’m still undecided whether I’m going to introduce a bit of static type constraints or not. Take for example this pattern:

x = Pseq([[3.0, 4.0], 5.0], 3) + 5
x.asStream.all  // [ [ 8, 9 ], 10, [ 8, 9 ], 10, [ 8, 9 ], 10 ]

which would be allowed in SuperCollider.

I’m looking at a meaningful subset of these operations. Here is an attempt to model the pattern elements (Elem) with types:

Any feedback would be appreciated.

best, .h.h.