[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] ListPatterns: a modest proposal



Done, removed.

In my build, I have changed the method to read as follows. Would something similar be appropriate for the main line?

*new { arg list, repeats=1;
list.isKindOf(SequenceableCollection).not.if({
"ListPattern: list is not a SequenceableCollection. Streams from this pattern may crash sclang.".warn;
});
^super.new.list_(list).repeats_(repeats)
}


On Wednesday, Jan 28, 2004, at 02:25 US/Eastern, James McCartney wrote:

no. take it out.
isKindOf is bad style and restricts things to a certain implementation instead of to things that respond to a certain protocol.


On Jan 27, 2004, at 7:20 PM, James Harkins wrote:

Tested and committed:

ListPattern : Pattern {
var <>list, <>repeats=1;


*new { arg list, repeats=1;
^super.new.list_(
list.isKindOf(SequenceableCollection).if({ list }, { [list] })
).repeats_(repeats)
}
.....
}

H. James

On Monday, Jan 26, 2004, at 22:17 US/Eastern, James Harkins wrote:

x = Pseq(1, inf).asStream;
x.next

Good way to hang sclang. The reason is that x.list.size is always 0, so the .embedInStream never gets called and the Pseq stream loops infinitely.

Would there be any harm in checking, at instantiation, to make sure the list in a ListPattern is really a SequenceableCollection? sclang shouldn't be that easy to break.

list.isKindOf(SequenceableCollection).not.if({ list = [list] });

This "feature" has tripped me up more than once. It just cost me the better part of an hour. Grr.

H. James
____________________________________

H. James Harkins /// dewdrop_world
http://www.duke.edu/~jharkins

"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly

_______________________________________________
sc-dev mailing list
sc-dev@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev


____________________________________

H. James Harkins /// dewdrop_world
http://www.duke.edu/~jharkins

"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly

_______________________________________________
sc-dev mailing list
sc-dev@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev

--
--- james mccartney james@xxxxxxxxxxxxxx <http://www.audiosynth.com>
SuperCollider - a real time audio synthesis programming language

_______________________________________________
sc-dev mailing list
sc-dev@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev


____________________________________

H. James Harkins /// dewdrop_world
http://www.duke.edu/~jharkins

"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly