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

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



OK, I'll remove it tonight. If it's urgent, someone
else should do it since I don't have my mac at work.

What do you propose as a better solution? To me,

Pseq(1, inf)

is rather innocuous but when you make it into a
stream, it will break sclang every time.

Maybe post a warning at creation instead of modifying
the data? If you're doing something with environments
or events as in your example, you can ignore the
warning and life goes on.

Also, I did post about this a whole day before
committing anything... how long should I wait between
proposing and committing? I notice that much of what I
suggest never raises an eyebrow... so if I wait for
explicit permission, it will never get done. It seems
I have to commit something before anyone will pay
attention.

I guess my mistake was not putting APPROVE in the
subject line.

Sorry for jumping the gun,
James

--- James McCartney <asynth@xxxxxx> 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


=====
____   James Harkins /// dewdrop world
\  /   jamshark70@xxxxxxxxx
 \/    http://www.duke.edu/~jharkins

"... love and hot pants, peace, harmony..."
  -- Dick Lee, Hot Pants: The Musical

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/