Re: Association is not properly embeddable

[email protected] Tue, 4 Feb 2020 16:12:51 +0800
Newsgroups gmane.comp.audio.supercollider.devel
Message-ID <CAFniQ7V4PAcXXCPHvhaAxuuGm3EvMv7L+MvUv_CiKT=FmNDWVg@mail.gmail.com>
On Mon, Feb 3, 2020 at 10:53 PM <rohrhuber-g/[email protected]> wrote:
> Agreed, but it has been like this since at least 23 years, just checked in SC 2.2.16.

Sure, I think this case is probably not enough to justify changing it.
And, in the place where I hit the issue, I never expect an array to
come from the stream, so I can simply .unbubble it.

`embedInStream` seems to have two notions of embedding -- embedding
some return value into the stream, and embedding the pattern's yielded
value into a container that was passed in. The first of these is
carefully defined. The second is not.

Pbind(\a, 1, \b, 2, \c, Pn((a: 3), 1)).asStream.next(())
-> ( 'c': ( 'a': 3, 'b': 2 ), 'a': 1, 'b': 2 )

^^ Why does 'b' need to be duplicated within 'c'?

Pbind(\a, 1, \b, 2, \c, Pn((\a -> 3), 1)).asStream.next(())
-> ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': ( 'c': (
'c': ( 'c': ( 'c': ( 'c': (...etc...

It may be 23 years old and it may have originated with James McCartney
himself, but... let's be honest. That's awful. It's unstable
(infinitely self-referential data structure) to yield an association
from a pattern in the context of a Pbind.

It was probably originally a passing thought that was never properly
tested (because if it had been, I'm quite sure JMc would have removed
that).

> We should think carefully and review the whole event stream system if we want to change that assumption!

Probably not for SC3, then, but SC4 should probably clean these cases up.

But I'm not sure it needs such a comprehensive review. `embedInStream`
as a name is quite clear about what it should do. This other concept
of embedding strikes me as extra, and as far as I know, only
Dictionary:embedInStream and Association:embedInStream are problems.

I don't think we should just change it summarily because it might
break some code. But it would be justified to clean up the definition
of this method name by removing the second type of embedding.

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/