Hello,
as I have once again done some on PuREST JSON, I had the idea to split an object into two seperate objects and provide the original object as an abstraction with the library, where the abstraction provides exactly the same semantics and logic of the original object.
Is there any pitfall to that approach? One thing I need to take care for are creation arguments. Anything else I need to consider?
Thanks, Thomas
"Prisons are needed only to provide the illusion that courts and police are effective. They're a kind of job insurance." (Leto II. in: Frank Herbert, God Emperor of Dune) http://www.residuum.org/
Hi Thomas,
On Tue, Sep 25, 2012 at 12:35 AM, Thomas Mayer thomas@residuum.org wrote:
Is there any pitfall to that approach? One thing I need to take care for are creation arguments. Anything else I need to consider?
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
--Funs
*) doing it this way the float object contains nothing, i.e. a zero, if no creation arguments are passed:
[loadbang] | [f $1]
----- Mail original -----
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
Colet Patrice
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Maybe dirty but skillful!
Is it possible to have this included somewhere in pdx abs?
De: "Cyrille Henry" ch@chnry.net
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
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
Le 25/09/2012 17:07, Patrice Colet a écrit :
Maybe dirty but skillful!
Is it possible to have this included somewhere in pdx abs?
i don't wish to include that in the externals i share on pd svn. anyway, my externals collection are not included in pdX.
so, fell free to do whatever you wish with this patch.
cheers c
De: "Cyrille Henry" ch@chnry.net
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
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
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
If you use Pd-l2ork there is no need for dirty hacks.
Using...
[list append $@]
... you can get all the arguments to the abstraction.
Obviously once you have them you can check to see whether the argument exists, and if it does not set a default value.
If you use iemguts or my patch on the tracker that gives you parent args all the way up to the toplevel you can encapsulate the process of setting default arg values in an abstraction.
-Jonathan
----- Original Message -----
From: Cyrille Henry ch@chnry.net To: pd-list@iem.at Cc: Sent: Tuesday, September 25, 2012 12:35 PM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
Le 25/09/2012 17:07, Patrice Colet a écrit :
Maybe dirty but skillful!
Is it possible to have this included somewhere in pdx abs?
i don't wish to include that in the externals i share on pd svn. anyway, my externals collection are not included in pdX.
so, fell free to do whatever you wish with this patch.
cheers c
De: "Cyrille Henry" ch@chnry.net
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never
figured out a
way to give another default value *). For C-objects it is possible
to
use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep
0
as another value
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
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
On 2012-09-25 22:22, Jonathan Wilkes wrote:
If you use Pd-l2ork there is no need for dirty hacks.
Using...
[list append $@]
afaik, this is "standard" Pd-extended.
fgmadfr IOhannes
Can somebody confirm this? Because the patch is still "open" on the tracker: http://sourceforge.net/tracker/?func=detail&aid=1543850&group_id=557... Thanks, Jonathan
From: IOhannes m zmoelnig zmoelnig@iem.at To: pd-list@iem.at Sent: Wednesday, September 26, 2012 4:59 AM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2012-09-25 22:22, Jonathan Wilkes wrote:
If you use Pd-l2ork there is no need for dirty hacks.
Using...
[list append $@]
afaik, this is "standard" Pd-extended.
fgmadfr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAlBiw/oACgkQkX2Xpv6ydvSUjQCg0SYhlJUmQdAwO6R1h0L80eRJ Y6AAoOMippb9RUCbnmcy04urSMPwQ3v/ =hT8g -----END PGP SIGNATURE-----
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2012-09-26 17:58, Jonathan Wilkes wrote:
Can somebody confirm this? Because the patch is still "open" on the tracker:
i'd like to keep it open for Pd-vanilla.
fgmasdr IOhannes
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 09/26/2012 12:44 PM, IOhannes m zmoelnig wrote:
On 2012-09-26 17:58, Jonathan Wilkes wrote:
Can somebody confirm this? Because the patch is still "open" on the tracker:
i'd like to keep it open for Pd-vanilla.
Yeah, when I accept patched into pd-extended, I don't close them if it also applies to pd-vanilla. I assign it to Miller, and leave a comment that I accepted it.
.hc
On Mit, 2012-09-26 at 08:58 -0700, Jonathan Wilkes wrote:
Can somebody confirm this? Because the patch is still "open" on the tracker: http://sourceforge.net/tracker/?func=detail&aid=1543850&group_id=557...
If you mean by 'confirm' to test it, yeah, it works in Pd-extended. I'd love to see it in Pd as well.
The situation that this feature is working in one flavor but not in the other is a bit unlucky. Contrary to the GUI enhancements, this really renders patches using this feature incompatible with Pd.
Roman
From: IOhannes m zmoelnig <zmoelnig@iem.at> To: pd-list@iem.at Sent: Wednesday, September 26, 2012 4:59 AM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-09-25 22:22, Jonathan Wilkes wrote: > If you use Pd-l2ork there is no need for dirty hacks. > > Using... > > [list append $@] > afaik, this is "standard" Pd-extended. fgmadfr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlBiw/oACgkQkX2Xpv6ydvSUjQCg0SYhlJUmQdAwO6R1h0L80eRJ Y6AAoOMippb9RUCbnmcy04urSMPwQ3v/ =hT8g -----END PGP SIGNATURE----- _______________________________________________ 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
I mentioned using it in object boxes for getting args, which as far as I can tell in Pd-l2ork works fine. But keep in mind there is a crasher bug that can easily manifest itself inside message boxes:
[bang( | [f 1000] | [until] | [list]x[list append foo] | [$@(
There was already a discussion about this somewhere on the list; it's a known bug in the Pd-l2ork implementation of the $@ patch.
If there's a way to make $@ safely take an arbitrary number of args without crashing (like the list family objects) that would be ideal, but after inquiring to both matju and Ivica about that it seems like it's a difficult task. (I would have inquired on this list but I didn't know or forgot it was in Pd extended 0.43...)
-Jonathan
----- Original Message -----
From: Roman Haefeli reduzent@gmail.com To: pd-list@iem.at Cc: Sent: Wednesday, September 26, 2012 2:34 PM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
On Mit, 2012-09-26 at 08:58 -0700, Jonathan Wilkes wrote:
Can somebody confirm this? Because the patch is still "open" on
the
tracker:
http://sourceforge.net/tracker/?func=detail&aid=1543850&group_id=557...
If you mean by 'confirm' to test it, yeah, it works in Pd-extended. I'd love to see it in Pd as well.
The situation that this feature is working in one flavor but not in the other is a bit unlucky. Contrary to the GUI enhancements, this really renders patches using this feature incompatible with Pd.
Roman
From: IOhannes m zmoelnig zmoelnig@iem.at To: pd-list@iem.at Sent: Wednesday, September 26, 2012 4:59 AM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2012-09-25 22:22, Jonathan Wilkes wrote: > If you use Pd-l2ork there is no need for dirty hacks. > > Using... > > [list append $@] > afaik, this is "standard" Pd-extended. fgmadfr IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlBiw/oACgkQkX2Xpv6ydvSUjQCg0SYhlJUmQdAwO6R1h0L80eRJ Y6AAoOMippb9RUCbnmcy04urSMPwQ3v/ =hT8g -----END PGP SIGNATURE----- _______________________________________________ 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
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Please add the crash report to the patch report so that we can track it.
.hc
On 09/26/2012 03:40 PM, Jonathan Wilkes wrote:
I mentioned using it in object boxes for getting args, which as far as I can tell in Pd-l2ork works fine. But keep in mind there is a crasher bug that can easily manifest itself inside message boxes:
[bang( | [f 1000] | [until] | [list]x[list append foo] | [$@(
There was already a discussion about this somewhere on the list; it's a known bug in the Pd-l2ork implementation of the $@ patch.
If there's a way to make $@ safely take an arbitrary number of args without crashing (like the list family objects) that would be ideal, but after inquiring to both matju and Ivica about that it seems like it's a difficult task. (I would have inquired on this list but I didn't know or forgot it was in Pd extended 0.43...)
-Jonathan
----- Original Message -----
From: Roman Haefeli reduzent@gmail.com To: pd-list@iem.at Cc: Sent: Wednesday, September 26, 2012 2:34 PM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
On Mit, 2012-09-26 at 08:58 -0700, Jonathan Wilkes wrote:
Can somebody confirm this? Because the patch is still "open" on
the
tracker:
http://sourceforge.net/tracker/?func=detail&aid=1543850&group_id=557...
If you mean by 'confirm' to test it, yeah, it works in Pd-extended. I'd love to see it in Pd as well.
The situation that this feature is working in one flavor but not in the other is a bit unlucky. Contrary to the GUI enhancements, this really renders patches using this feature incompatible with Pd.
Roman
From: IOhannes m zmoelnig <zmoelnig@iem.at> To: pd-list@iem.at Sent: Wednesday, September 26, 2012 4:59 AM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
Using...
[list append $@]
afaik, this is "standard" Pd-extended.
fgmadfr IOhannes
_______________________________________________ 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
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
Interesting. But its not really useable with dollar args, unfortunately, where $@ is.
[default_arg $1] won't tell you whether $1 was set or not since it'll show up as zero to defulat-arg.pd
.hc
On 09/25/2012 10:08 AM, Cyrille Henry wrote:
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
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
hello
Le 11/10/2012 18:26, Hans-Christoph Steiner a écrit :
Interesting. But its not really useable with dollar args, unfortunately, where $@ is.
[default_arg $1] won't tell you whether $1 was set or not since it'll show up as zero to defulat-arg.pd
well, yes, but one can arg that in this example ([default_arg $1]) 1 argument ($1) is provided to default_arg. so 0 is the right answer.
This patch was just a proof of concept. you have to use this trick in a sub-patch, not as an abstraction. anyway, i know that this is not a generic solution to this problem.
cheers c
.hc
On 09/25/2012 10:08 AM, Cyrille Henry wrote:
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
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
When $1 exists and has the value 0: [symbol $1-foo] = 0-foo
When there is no $1: [symbol $1-foo] = \$1-foo
Therefore not only can you tell if an argument was set to 0 in Pd vanilla, but you can fetch the entire list of args by counting up from $1 until $n-foo = \$n-foo.
There are subpatches and abstractions on this list that use that method to fetch the args in Pd Vanilla.
There is probably also an external for every developer who has needed this functionality in their own patches, most of which are available in Pd-extended.
-Jonathan
From: Hans-Christoph Steiner hans@at.or.at To: Cyrille Henry ch@chnry.net Cc: pd-list@iem.at Sent: Thursday, October 11, 2012 12:26 PM Subject: Re: [PD] creation arg, distinction between 0 and no arg, WAS Re: Splitting Objects
Interesting. But its not really useable with dollar args, unfortunately, where $@ is.
[default_arg $1] won't tell you whether $1 was set or not since it'll show up as zero to defulat-arg.pd
.hc
On 09/25/2012 10:08 AM, Cyrille Henry wrote:
hello,
a dirty hack allow distinction between no argument and a 0 float arg. see attachment. cheers c
Le 25/09/2012 15:45, Patrice Colet a écrit :
De: "Patrice Colet" colet.patrice@free.fr
De: "Funs Seelen" funsseelen@gmail.com
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
[loadbang] | [$1] | [sel 0] | [my default value(
indeed it doesn't seem possible to set a default value and keep 0 as another value
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
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On 09/25/2012 09:18 AM, Funs Seelen wrote:
Hi Thomas,
On Tue, Sep 25, 2012 at 12:35 AM, Thomas Mayer thomas@residuum.org wrote:
Is there any pitfall to that approach? One thing I need to take care for are creation arguments. Anything else I need to consider?
Speaking about creation arguments: if none are given for abstractions the default value is always "0" (at least I never figured out a way to give another default value *). For C-objects it is possible to use any float value as default.
--Funs
*) doing it this way the float object contains nothing, i.e. a zero, if no creation arguments are passed:
[loadbang] | [f $1]
Look at purepd/float_argument, purepd/any_argument, and purepd/symbol_argument if you want to have more control over defaults for abstractions.
I think iemguts also has some stuff there.
.hc