Dictionary:embedInStream requires inval to be a Dictionary, why?
[email protected] Sat, 11 Jan 2020 18:00:00 +0800
| Newsgroups | gmane.comp.audio.supercollider.devel |
|---|---|
| Message-ID | <CAFniQ7WbGA0bLMA1V6m4VMnNS6QCikLy7YH_Um7vvM7ySmH3xg@mail.gmail.com> |
Is there a good reason for the following discrepancy?
p = Prand([(a: 1), (a: 2)], inf).asStream;
p.next; // ok
p.next(()); // ok
p.next(0); // Message 'putAll' not understood.
The current logic assumes that there is never any reason for a pattern
to return an event, other than to insert the returned the event's
values into the event being passed in. While Dictionary:embedInStream
allows inval to be nil, it strictly requires that any other inval
absolutely must be a dictionary, no exception allowed.
But I did have a case just now where I needed to pass a number into a
stream, but the stream needs to return events that are being used as
object prototypes.
Currently, this use case is forbidden, and I can't see a good reason
why. I worked around it by passing the numeric value conditionally,
but... I dunno, it seems a bit rude of Dictionary:embedInStream to
behave this way.
^if(event.isNil) { this } { event.copy.putAll(this) }.yield
Should this not be as follows?
^if(event.respondsTo(\putAll)) { event.copy.putAll(this) } { this }.yield
hjh
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/