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

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



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