Seems like for any object that doesn't have a bang method nor list method, an empty list silently gets discarded.
compare
[bang( | [sin]
to
[list( | [sin]
or, more likely
[bang(
| [t a] | [sin]
Same for [select] and many others.
Is there a way to fix this?
-Jonathan
I wonder if we could as part of the setup call for each external somehow infer default behaviors for each object e.g.:
something_bang() { Error("this inlet does not support bang message\n"); } etc.
Then if that particular object has another addmethod after it referencing its own genuine bang (or whatever) method, such call would override the original. I am just not sure if this is possible in the first place and whether that could produce some misleading messages as well (e.g. I just fixed cxc/ascseq crash when receiving a bang but this was solved without having the bang function--this may be fixed by the aforesaid approach as long as this is somehow possible as part of the setup function and without having to manually alter every single external's setup function and assuming that bang function will take precedence over the anything function).
Thoughts?
-----Original Message----- From: pd-list-bounces@iem.at [mailto:pd-list-bounces@iem.at] On Behalf Of Jonathan Wilkes Sent: Monday, February 25, 2013 8:18 PM To: pd-list Subject: [PD] bang vs empty list
Seems like for any object that doesn't have a bang method nor list method, an empty list silently gets discarded.
compare
[bang( | [sin]
to
[list( | [sin]
or, more likely
[bang(
| [t a] | [sin]
Same for [select] and many others.
Is there a way to fix this?
-Jonathan
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Each class has methods that can be looked up by symbol. At some point after the class has been created, you could check the class has no bang method, and if so, add the default bang method. Only built-in classes are loaded when pd starts up, so if you load a class later, it would not have the default method.
If you wanted it done at setup time, you would have to modify the function that calls the setup function (I don't know what it is or how it's done--please tell me) so you would follow the setup function and add default methods.
Chuck
On Wed, Feb 27, 2013 at 5:05 PM, Ivica Ico Bukvic ico@vt.edu wrote:
I wonder if we could as part of the setup call for each external somehow infer default behaviors for each object e.g.:
something_bang() { Error("this inlet does not support bang message\n"); } etc.
Then if that particular object has another addmethod after it referencing its own genuine bang (or whatever) method, such call would override the original. I am just not sure if this is possible in the first place and whether that could produce some misleading messages as well (e.g. I just fixed cxc/ascseq crash when receiving a bang but this was solved without having the bang function--this may be fixed by the aforesaid approach as long as this is somehow possible as part of the setup function and without having to manually alter every single external's setup function and assuming that bang function will take precedence over the anything function).
Thoughts?
-----Original Message----- From: pd-list-bounces@iem.at [mailto:pd-list-bounces@iem.at] On Behalf
Of
Jonathan Wilkes Sent: Monday, February 25, 2013 8:18 PM To: pd-list Subject: [PD] bang vs empty list
Seems like for any object that doesn't have a bang method nor list
method,
an empty list silently gets discarded.
compare
[bang( | [sin]
to
[list( | [sin]
or, more likely
[bang(
| [t a] | [sin]
Same for [select] and many others.
Is there a way to fix this?
-Jonathan
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
i guess i'm missing something, but...
On 2013-02-28 00:38, Charles Z Henry wrote:
Each class has methods that can be looked up by symbol. At some point after the class has been created, you could check the class has no bang method, and if so, add the default bang method. Only built-in classes are loaded when pd starts up, so if you load a class later, it would not have the default method.
each object has a default method, namely the defaul catch-all ("aka "anything") method, that will print "no method for <foo>". not having an explicit "bang" method, will defer the "bang" message to this catch-all method.
If you wanted it done at setup time, you would have to modify the function that calls the setup function (I don't know what it is or how it's done--please tell me) so you would follow the setup function and add default methods.
not sure whether i totally understand what you mean by "setup time" (and "setup function") here. the function that calls the setup function does not do anything special (it just calls an entry point in a dll). especially, it does notmake any assumptions what this setup function is going to perform (though in most cases it will register some classes).
so, the only function that needed to be changed would be the generic class-creator function class_new().
nevertheless i don't see what this would solve with respect to the current behaviour.
i can imagine that the problems you are trying to solve are caused by Pd's automatic conversions between different types (e.g. [list 12( and [float 12(). if you removed all those conversions, you would immediately get your "desired" behaviour. and people would start complaining why the following gives an error "[sin]: no method for 'list'". [1 2 3( | [list split 1] | [sin]
this can of course be fixed by simply adding an explicit "list" method to [sin], which does "the right thing". but all the problems that arise because of the automatic message conversion can already be solved by adding explicit methods for messages you don't want to be autoconverted.
btw, i think something really nice to have would be per-object methods (as oppposed to per-class methods). for this to work, the object would need a copy of the class method table (rather than a reference).
fgamsdr IOhannes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-02-26 02:17, Jonathan Wilkes wrote:
Seems like for any object that doesn't have a bang method nor list method, an empty list silently gets discarded.
[...]
Is there a way to fix this?
sure :-)
the default list method will try to do something clever with the empty list:
not the case for [sin])
(which is not the case for [sin])
distribute the atoms over the inlets. since there are 0 atoms, no inlet will receive any data.
so i think there are two things to fix:
attached are fixes for both problems (actually the 2nd patch makes [t a] output the message as it came in, rather than converting it to a list - so it also fixes the problem for numbers and symbols, not only for bangs) i rely on the community to test them thorougly :-)
there are still some weirdos though:
[float 42, list 666, list, foo( | [t s] | [print]
i wonder what the correct behaviour should actually be. intuitively i would say that for non-symbols, [t s] should output the selector as a symbol (if we don't want to introduce "%d" semantics which i would rather not for performance reasons). this would also make sense for anythings, where we currently get that weird "only convert 's' to 'b' or 'a'" (it's weird insofar as it takes some time to see what the 's' is referring to)
fgm,asdr IOhannes
How about further expanding trigger to tolerate a->s by simply taking the very first argument if the first argument is not type descriptor? See attached.
e.g.
[foo< | [t s] | [print]
would output foo.
foo bar->outputs foo bar foo->outputs bar
On 02/28/2013 19:34, Ivica Ico Bukvic wrote:
How about further expanding trigger to tolerate a->s by simply taking the very first argument if the first argument is not type descriptor?
that's what i was proposing, though i used terminology which i think is more common, e.g. "selector" instead of "type descriptor" ("foo" is really _not_ a type-descriptor, but instead is the CAR that selects (sic!) a method of an object).
See attached.
to which versionn of Pd should this be applied? doesn't seem to be compatible with Pd master/git.
anyhow, yes, i agree that the implementation is fairly simple, i was more concerned with the question what's the *right* thing to do.
fgmadrs IOhannes
This is for pd-l2ork, but should be near identical to regular. Pd-l2ork's trigger is also capable of static values like Max's, so this may be the discrepancy in source. On Feb 28, 2013 2:29 PM, "IOhannes m zmölnig" zmoelnig@iem.at wrote:
On 02/28/2013 19:34, Ivica Ico Bukvic wrote:
How about further expanding trigger to tolerate a->s by simply taking the very first argument if the first argument is not type descriptor?
that's what i was proposing, though i used terminology which i think is more common, e.g. "selector" instead of "type descriptor" ("foo" is really _not_ a type-descriptor, but instead is the CAR that selects (sic!) a method of an object).
See attached.
to which versionn of Pd should this be applied? doesn't seem to be compatible with Pd master/git.
anyhow, yes, i agree that the implementation is fairly simple, i was more concerned with the question what's the *right* thing to do.
fgmadrs IOhannes
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
BTW, the only regression with this is that [select] object complains it does not understand "bang." I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang] will. I think that makes sense since someone might want to select letter "b."
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains it does not understand "bang."
Pd's [select] only understands symbol and float messages. If you make it accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang] will. I think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Yes, but it also prevents profuse errors on the console regarding how select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported. On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains it
does not
understand "bang."
Pd's [select] only understands symbol and float messages. If you make it accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang]
will. I
think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
To add to this, I cannot think of a scenario where you would want to differentiate between bang versus symbol bang. Please feel free to convince me otherwise. On Mar 1, 2013 7:50 AM, "Ivica Bukvic" ico@vt.edu wrote:
Yes, but it also prevents profuse errors on the console regarding how select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported. On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains it
does not
understand "bang."
Pd's [select] only understands symbol and float messages. If you make it accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang]
will. I
think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 7:55 AM Subject: Re: [PD] bang vs empty list
To add to this, I cannot think of a scenario where you would want to differentiate between bang versus symbol bang. Please feel free to convince me otherwise.
Just one example:
If you parse a Pd patch in Pd you'll want to handle everything as lists, because the moment you shave off the list selector you're in danger of outputting bad messages:
"#X text 10 10 INLET_0 bang float symbol"
| [route #X] | [route text] | [route 10] | [route 10] | [route INLET_0] | [route bang] | [route float] <-- oops, "float" got silently discarded above
Of course that's just a didactic example, because in real life you would iterate over the message one atom at a time, and if "bang" and "float" had been switched above you'd even get an explicit error about "Bad arguments" (since float needs to be followed by a float atom and not the symbol atom "bang"). Therefore you have to use list objects to ensure you don't lose data or run into a badly formed mesage, and when you split lists you end up with "symbol bang" which [select] handles perfectly well.
The point is that select inspects the payload of the message and not the selector. Bang messages don't have a payload so you've now made a special case where the selector is inspected only if the user types "bang" as an arg. The [route] object already chooses bases on selector so I don't see a reason to change the behavior for [select] in this way.
-Jonathan
On Mar 1, 2013 7:50 AM, "Ivica Bukvic" ico@vt.edu wrote:
Yes, but it also prevents profuse errors on the console regarding how select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported.
On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains it does not understand "bang."
Pd's [select] only understands symbol and float messages. If you make it accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang] will. I think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
This makes perfect sense. However, I have at least a couple of patches where I have a select connected to a networked stream of messages one which includes bang. So after I have to appied IOhannes' patch, this effectively resulted in a regression where bang messages were not recognized by the select object, throwing a large number of errors. While one can argue that this is simply a poorly designed patch the other side of the coin is to say that this latest addition has caused a breakage in the existing patches as this problem was never reported by pd before and now is causing xruns. I also hear your call for consistency so I am open for going either way particularly because the example you gave did not use select. After all what follows from select is nothing more than a bang while symbol bang would be intercepted anyways. On Mar 1, 2013 11:47 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 7:55 AM Subject: Re: [PD] bang vs empty list
To add to this, I cannot think of a scenario where you would want to
differentiate between bang versus symbol bang. Please feel free to convince me otherwise.
Just one example:
If you parse a Pd patch in Pd you'll want to handle everything as lists, because the moment you shave off the list selector you're in danger of outputting bad messages:
"#X text 10 10 INLET_0 bang float symbol"
| [route #X] | [route text] | [route 10] | [route 10] | [route INLET_0] | [route bang] | [route float] <-- oops, "float" got silently discarded above
Of course that's just a didactic example, because in real life you would iterate over the message one atom at a time, and if "bang" and "float" had been switched above you'd even get an explicit error about "Bad arguments" (since float needs to be followed by a float atom and not the symbol atom "bang"). Therefore you have to use list objects to ensure you don't lose data or run into a badly formed mesage, and when you split lists you end up with "symbol bang" which [select] handles perfectly well.
The point is that select inspects the payload of the message and not the selector. Bang messages don't have a payload so you've now made a special case where the selector is inspected only if the user types "bang" as an arg. The [route] object already chooses bases on selector so I don't see a reason to change the behavior for [select] in this way.
-Jonathan
On Mar 1, 2013 7:50 AM, "Ivica Bukvic" ico@vt.edu wrote:
Yes, but it also prevents profuse errors on the console regarding how
select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported.
On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains
it does not
understand "bang."
Pd's [select] only understands symbol and float messages. If you make
it
accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang]
will. I
think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 12:03 PM Subject: Re: [PD] bang vs empty list
This makes perfect sense. However, I have at least a couple of patches where I have a select connected to a networked stream of messages one which includes bang. So after I have to appied IOhannes' patch, this effectively resulted in a regression where bang messages were not recognized by the select object, throwing a large number of errors.
I don't understand. When did you change [select] to accept bang messages? Or are you saying that you were receiving the message "list" and it went unreported?
While one can argue that this is simply a poorly designed patch the other side of the coin is to say that this latest addition has caused a breakage in the existing patches as this problem was never reported by pd before and now is causing xruns. I also hear your call for consistency so I am open for going either way particularly because the example you gave did not use select. After all what follows from select is nothing more than a bang while symbol bang would be intercepted anyways.
There are probably very few cases where one would actually need to differentiate between "bang" and "symbol bang" using [select], but it seems like bad design to let two distinct messages trigger the same behavior in an object whose sole purpose is to differentiate messages from each other.
Anyway, you could fix your patches simply by inserting [route bang] before your [select].
-Jonathan
On Mar 1, 2013 11:47 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 7:55 AM Subject: Re: [PD] bang vs empty list
To add to this, I cannot think of a scenario where you would want to differentiate between bang versus symbol bang. Please feel free to convince me otherwise.
Just one example:
If you parse a Pd patch in Pd you'll want to handle everything as lists, because the moment you shave off the list selector you're in danger of outputting bad messages:
"#X text 10 10 INLET_0 bang float symbol"
| [route #X] | [route text] | [route 10] | [route 10] | [route INLET_0] | [route bang] | [route float] <-- oops, "float" got silently discarded above
Of course that's just a didactic example, because in real life you would iterate over the message one atom at a time, and if "bang" and "float" had been switched above you'd even get an explicit error about "Bad arguments" (since float needs to be followed by a float atom and not the symbol atom "bang"). Therefore you have to use list objects to ensure you don't lose data or run into a badly formed mesage, and when you split lists you end up with "symbol bang" which [select] handles perfectly well.
The point is that select inspects the payload of the message and not the selector. Bang messages don't have a payload so you've now made a special case where the selector is inspected only if the user types "bang" as an arg. The [route] object already chooses bases on selector so I don't see a reason to change the behavior for [select] in this way.
-Jonathan
On Mar 1, 2013 7:50 AM, "Ivica Bukvic" ico@vt.edu wrote:
Yes, but it also prevents profuse errors on the console regarding how select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported.
On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
From: Ivica Ico Bukvic ico@vt.edu To: pd-list@iem.at Cc: Sent: Thursday, February 28, 2013 7:15 PM Subject: Re: [PD] bang vs empty list
BTW, the only regression with this is that [select] object complains it does not understand "bang."
Pd's [select] only understands symbol and float messages. If you make it accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
I've patched it so that when it receives a bang it redirects it to sel1_symbol and sel2_symbol with a gensym("bang"). This also means that [sel b] would not work for bangs, but [sel bang] will. I think that makes sense since someone might want to select letter "b."
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Mar 1, 2013 12:14 PM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 12:03 PM Subject: Re: [PD] bang vs empty list
This makes perfect sense. However, I have at least a couple of patches
where I have a select connected to a networked stream of messages one which includes bang. So after I have to appied IOhannes' patch, this effectively resulted in a regression where bang messages were not recognized by the select object, throwing a large number of errors.
I don't understand. When did you change [select] to accept bang
messages? Or are you saying
that you were receiving the message "list" and it went unreported?
Yes they were being registered as list that before IOhannes' patch and now are being reported as errors. so I opted for the select patch I proposed above.
While one can argue that this is simply a poorly designed patch the
other side of the coin is to say that this latest addition has caused a breakage in the existing patches as this problem was never reported by pd before and now is causing xruns. I also hear your call for consistency so I am open for going either way particularly because the example you gave did not use select. After all what follows from select is nothing more than a bang while symbol bang would be intercepted anyways.
There are probably very few cases where one would actually need to
differentiate between "bang" and "symbol bang" using [select], but it seems like bad design to let two distinct messages trigger the same
behavior in an object whose sole purpose is to differentiate messages
from each other.
At the same time I think having to cover bang to symbol bang just to have it selectable by select does not seem very intuitive to me. How would you even do that in the first place if there's more than just a bang coming into that inlet, e.g. a bang and float values? You couldn't use [symbol] before it as that would trash float values.
Anyway, you could fix your patches simply by inserting [route bang]
before your [select].
That is what I did, but that does not address the issue above.
-Jonathan
On Mar 1, 2013 11:47 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 7:55 AM Subject: Re: [PD] bang vs empty list
To add to this, I cannot think of a scenario where you would want to
differentiate between bang versus symbol bang. Please feel free to convince me otherwise.
Just one example:
If you parse a Pd patch in Pd you'll want to handle everything as
lists, because
the moment you shave off the list selector you're in danger of
outputting bad
messages:
"#X text 10 10 INLET_0 bang float symbol"
| [route #X] | [route text] | [route 10] | [route 10] | [route INLET_0] | [route bang] | [route float] <-- oops, "float" got silently discarded above
Of course that's just a didactic example, because in real life you would iterate over the message one atom at a time, and if "bang" and "float" had been switched above you'd even get an explicit error about "Bad arguments" (since float needs to be followed by a float atom and not the symbol atom "bang"). Therefore you have to use list objects to ensure you don't lose data or run into a badly formed mesage, and when you split lists you end up with "symbol bang" which [select] handles perfectly well.
The point is that select inspects the payload of the message and not the selector. Bang messages don't have a payload so you've now made a
special
case where the selector is inspected only if the user types "bang" as
an arg. The
[route] object already chooses bases on selector so I don't see a
reason to change
the behavior for [select] in this way.
-Jonathan
On Mar 1, 2013 7:50 AM, "Ivica Bukvic" ico@vt.edu wrote:
Yes, but it also prevents profuse errors on the console regarding how
select does not understand things which may happen in complex patches under certain circumstances, and which previously were not reported.
On Mar 1, 2013 3:29 AM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
----- Original Message -----
> From: Ivica Ico Bukvic ico@vt.edu > To: pd-list@iem.at > Cc: > Sent: Thursday, February 28, 2013 7:15 PM > Subject: Re: [PD] bang vs empty list > > BTW, the only regression with this is that [select] object
complains it does not
> understand "bang."
Pd's [select] only understands symbol and float messages. If you
make it
accept bangs then you create an inconsistency where both "symbol bang" and "bang" are matched by [sel bang].
-Jonathan
> I've patched it so that when it receives a bang > it redirects it to sel1_symbol and sel2_symbol with a
gensym("bang").
> This also means that [sel b] would not work for bangs, but [sel
bang] will. I
> think that makes sense since someone might want to select letter
"b."
> > _______________________________________________ > Pd-list@iem.at mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list >
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 1:41 PM Subject: Re: [PD] bang vs empty list
On Mar 1, 2013 12:14 PM, "Jonathan Wilkes" jancsika@yahoo.com wrote:
From: Ivica Bukvic ico@vt.edu To: Jonathan Wilkes jancsika@yahoo.com Cc: pd-list pd-list@iem.at Sent: Friday, March 1, 2013 12:03 PM Subject: Re: [PD] bang vs empty list
This makes perfect sense. However, I have at least a couple of patches where I have a select connected to a networked stream of messages one which includes bang. So after I have to appied IOhannes' patch, this effectively resulted in a regression where bang messages were not recognized by the select object, throwing a large number of errors.
I don't understand. When did you change [select] to accept bang messages? Or are you saying that you were receiving the message "list" and it went unreported?
Yes they were being registered as list that before IOhannes' patch and now are being reported as errors. so I opted for the select patch I proposed above.
While one can argue that this is simply a poorly designed patch the other side of the coin is to say that this latest addition has caused a breakage in the existing patches as this problem was never reported by pd before and now is causing xruns. I also hear your call for consistency so I am open for going either way particularly because the example you gave did not use select. After all what follows from select is nothing more than a bang while symbol bang would be intercepted anyways.
There are probably very few cases where one would actually need to differentiate between "bang" and "symbol bang" using [select], but it seems like bad design to let two distinct messages trigger the same behavior in an object whose sole purpose is to differentiate messages from each other.
At the same time I think having to cover bang to symbol bang just to have it selectable by select does not seem very intuitive to me. How would you even do that in the first place if there's more than just a bang coming into that inlet, e.g. a bang and float values? You couldn't use [symbol] before it as that would trash float values.
Outputting the message from [textfile] (which has its own problems because it outputs anything instead of list), then something like [list-drip]. Splitting the message up in the list domain ensures that you won't lose data since everything is treated as a list. So if there is the word "bang" somewhere in the middle of the message it will come out of [list-drip] (or a home-brewed one using [list split]) as "list bang" which gets interpreted by [select] as a symbol message. That's the only way to parse a text file in Pd without running into errors (although you'll still lose data, for example, if consecutive whitespaces are needed, or special characters that Pd escapes, etc.).
-Jonathan
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-03-01 18:03, Ivica Bukvic wrote:
This makes perfect sense. However, I have at least a couple of patches where I have a select connected to a networked stream of messages one which includes bang. So after I have to appied IOhannes' patch, this effectively resulted in a regression where bang messages were not recognized by the select object, throwing a large number of errors. While one can argue that this is simply a poorly designed patch the other side of the coin is to say that this latest addition has caused a breakage in the existing patches as this problem was never reported by pd before and now is causing xruns. I also hear your call for consistency so I am open for going either way particularly because the example you gave did not use select. After all what follows from select is nothing more than a bang while symbol bang would be intercepted anyways.
thanks for the test. however, i'm not entirely sure whether this is really a regression (or a poorly designed patch).
my patch will make empty lists do something meaningful (that is: check whether the object can handle them) rather than simply ignore them, but that was the point of the patch.
before my patch, [select] would emit a "no method for 'bang'" whenever it received a [bang(, and it would do nothing when it received a [list( (neither "accept" nor "reject" the message through it's designated outlets). now it will emit a "no method for 'list'" whenever it gets a [list(, and retain the original behaviour for all other messages. this is the intended behaviour.
i tried to reproduce your test-case, but it seems to behave differently on pd-vanilla than on pd-l2ork. this is what i tried:
[connect localhost 7777(
[r data] | | | +---------+ | [netsend]
[netreceive 7777] | [select]
doing a [;data send bang( will give me a "select: no method for 'bang'" both with and without my patch applied. doing a [;data send( will give me nothing both with and without my patch applied (since [netsend] will not send an empty message).
could this be a regression in [dsis_netsend]/[dsis_netreceive] that has been exposed by my patch?
maybe it would help if you posted a patch that exposes the problem.
fgmasdr IOhannes
IOhannes,
Your patch has one regression:
--- a/src/x_connective.c +++ b/src/x_connective.c @@ -991,6 +991,8 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) else if (u->u_type == TR_SYMBOL) outlet_symbol(u->u_outlet, (argc ? atom_getsymbol(argv) : &s_symbol));
else if (u->u_type == TR_ANYTHING)
outlet_anything(u->u_outlet, s, argc, argv);
else if (u->u_type == TR_POINTER)
{
if (!argc || argv->a_type != TR_POINTER)
This part causes pointers to not properly propagate through the trigger objects. If you run scalar-help.pd file (part of pd-extended/pd-l2ork documentation developed by Jonathan and others), clicking on scalars that should animate generates an error. Removing this works fine for scalars but I wonder if it then disables functionality of the patch you provided.
Any thoughts?
On 03/21/2013 03:12 PM, Ivica Ico Bukvic wrote:
IOhannes,
Your patch has one regression:
--- a/src/x_connective.c +++ b/src/x_connective.c @@ -991,6 +991,8 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) else if (u->u_type == TR_SYMBOL) outlet_symbol(u->u_outlet, (argc ? atom_getsymbol(argv) : &s_symbol));
else if (u->u_type == TR_ANYTHING)
outlet_anything(u->u_outlet, s, argc, argv); else if (u->u_type == TR_POINTER) { if (!argc || argv->a_type != TR_POINTER)
This part causes pointers to not properly propagate through the trigger objects. If you run scalar-help.pd file (part of pd-extended/pd-l2ork documentation developed by Jonathan and others), clicking on scalars that should animate generates an error. Removing this works fine for scalars but I wonder if it then disables functionality of the patch you provided.
Any thoughts?
As of right now, I cannot see any regressions by removing that part since at the end it does output_list call anyhow. Can you test this/confirm?
On 03/21/2013 20:26, Ivica Ico Bukvic wrote:
On 03/21/2013 03:12 PM, Ivica Ico Bukvic wrote:
IOhannes,
hi
Your patch has one regression:
thanks for reporting
--- a/src/x_connective.c +++ b/src/x_connective.c @@ -991,6 +991,8 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) else if (u->u_type == TR_SYMBOL) outlet_symbol(u->u_outlet, (argc ? atom_getsymbol(argv) : &s_symbol));
else if (u->u_type == TR_ANYTHING)
outlet_anything(u->u_outlet, s, argc, argv); else if (u->u_type == TR_POINTER) { if (!argc || argv->a_type != TR_POINTER)
[...]
Any thoughts?
yep. outlet_list() is *not* the same as outlet_anything()....
As of right now, I cannot see any regressions by removing that part since at the end it does output_list call anyhow. Can you test this/confirm?
i cannot test right now, but i'm pretty sure that removing that very line makes my entire patch obsolete and reverts to the old behaviour.
which errors do you get?
fgmadsr IOhannes
On 03/21/2013 21:02, IOhannes m zmölnig wrote:
"inlet: expected 'pointer' but got 'pointer'"
so having a short go into m_class.c, it seems indeed that the c_pointermethod is called from within the list-method.
the attached patch should fix this, by using the "list" selector when outputting pointers through [trigger]. this should be totally compatible to the original behaviour (regarding pointers): org: outlet_list (out, 0 , 1, ptratom); new: outlet_anything(out, &s_list, 1, ptratom);
nevertheless it's probably good to hear some pointer expert's (e.g. miller's) opinion about how this *should* be handled.
fgmasrd IOhannes