Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
Note that this is a single-file library, eg hid.pd_linux.
Thanks for all ideas! P
On 10/7/19 1:42 PM, Peter P. wrote:
Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
yes. this is a feature of the hid library.
it prints a boilerplate at object instantiation time (but only for the first object instance), rather than at library load time.
gfamdsr IOhannes
On 10/7/19 1:42 PM, Peter P. wrote:
Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
yes. this is a feature of the hid library.
it prints a boilerplate at object instantiation time (but only for the first object instance), rather than at library load time.
Amazing feature! Thank you!
this is a feature of the hid library.
I guess this was sarcasm :-). Usually, such messages are posted in the setup routine, as IOhannes has mentioned. Since the setup routine is called whenever you create the first instance, you achieve the same effect.
BTW, what's the point of doing [declare -lib hid]? Or were you just experimenting?
Best, Christof
Gesendet: Montag, 07. Oktober 2019 um 13:49 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list@lists.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
- IOhannes m zmölnig zmoelnig@iem.at [2019-10-07 13:47]:
On 10/7/19 1:42 PM, Peter P. wrote:
Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
yes. this is a feature of the hid library.
it prints a boilerplate at object instantiation time (but only for the first object instance), rather than at library load time.
Amazing feature! Thank you!
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
this is a feature of the hid library.
I guess this was sarcasm :-). Usually, such messages are posted in the setup routine, as IOhannes has mentioned. Since the setup routine is called whenever you create the first instance, you achieve the same effect.
BTW, what's the point of doing [declare -lib hid]? Or were you just experimenting?
Best, Christof
Gesendet: Montag, 07. Oktober 2019 um 13:49 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list@lists.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
- IOhannes m zmölnig zmoelnig@iem.at [2019-10-07 13:47]:
On 10/7/19 1:42 PM, Peter P. wrote:
Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
yes. this is a feature of the hid library.
it prints a boilerplate at object instantiation time (but only for the first object instance), rather than at library load time.
Amazing feature!
And this was sarcasm too.
I was using [declare -lib hid] because this is how I load libraries in general.
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
Christof
Gesendet: Montag, 07. Oktober 2019 um 14:19 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list@lists.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
- Christof Ressi christof.ressi@gmx.at [2019-10-07 14:09]:
this is a feature of the hid library.
I guess this was sarcasm :-). Usually, such messages are posted in the setup routine, as IOhannes has mentioned. Since the setup routine is called whenever you create the first instance, you achieve the same effect.
BTW, what's the point of doing [declare -lib hid]? Or were you just experimenting?
Best, Christof
Gesendet: Montag, 07. Oktober 2019 um 13:49 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list@lists.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
- IOhannes m zmölnig zmoelnig@iem.at [2019-10-07 13:47]:
On 10/7/19 1:42 PM, Peter P. wrote:
Dear list,
I am a big fan of the [declare] object for loading libraries but its user interaction keeps puzzling me.
Creation of [declare -lib hid] does neither post a success or failure message to the console, but the creation of a [hid] object itself prints the usual [hid] 0.7, written by Hans-Christoph Steiner hans@eds.org compiled on Aug 8 2013 at 07:27:37
Seems like the above declare object has no function...
yes. this is a feature of the hid library.
it prints a boilerplate at object instantiation time (but only for the first object instance), rather than at library load time.
Amazing feature!
And this was sarcasm too.
I was using [declare -lib hid] because this is how I load libraries in general.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Christof Ressi wrote:
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
but only if the external is within a given serach path on PD startup.
i guess Peter was saying that he only loads libraries/externals explicitly when they are needed. (which is a good practice for testing purposes or prior to posting/sharing patches)
in the case of [hid] (or [hidin] on windows) it would be [declare -path hid] though, since (as christof correctly said) it's a single external rather than a multiobject library (like ZEXY, IEMLIB, IEMMATRIX, GEM).
best
oliver
Hey,
but only if the external is within a given serach path on PD startup.
Which is also true for [declare -lib] - it can't magically find libraries without having the correct search paths. Note that for every external "foo" the loader also tries "foo/foo", so [declare -path hid] is not necessary, you can just do [hid]. I don't see any purpose for [declare -lib hid] except maybe for documentation (but then I would just write a comment).
i guess Peter was saying that he only loads libraries/externals
explicitly when they are needed.
I don't get it. When I do [hid] - without [declare -lib] -, it will be exactly loaded when needed.
Christof
Gesendet: Montag, 07. Oktober 2019 um 14:50 Uhr Von: "oliver" oliver@klingt.org An: Pd-list pd-list@mail.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
Christof Ressi wrote:
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
but only if the external is within a given serach path on PD startup.
i guess Peter was saying that he only loads libraries/externals explicitly when they are needed. (which is a good practice for testing purposes or prior to posting/sharing patches)
in the case of [hid] (or [hidin] on windows) it would be [declare -path hid] though, since (as christof correctly said) it's a single external rather than a multiobject library (like ZEXY, IEMLIB, IEMMATRIX, GEM).
best
oliver
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
[declare -lib] can be useful with certain kind of (homemade) externals, where you have to ensure that a given class is declared before instantiating an object which itself refers to this class.
Le lun. 7 oct. 2019 à 15:08, Christof Ressi christof.ressi@gmx.at a écrit :
Hey,
but only if the external is within a given serach path on PD startup.
Which is also true for [declare -lib] - it can't magically find libraries without having the correct search paths. Note that for every external "foo" the loader also tries "foo/foo", so [declare -path hid] is not necessary, you can just do [hid]. I don't see any purpose for [declare -lib hid] except maybe for documentation (but then I would just write a comment).
i guess Peter was saying that he only loads libraries/externals
explicitly when they are needed.
I don't get it. When I do [hid] - without [declare -lib] -, it will be exactly loaded when needed.
Christof
Gesendet: Montag, 07. Oktober 2019 um 14:50 Uhr Von: "oliver" oliver@klingt.org An: Pd-list pd-list@mail.iem.at Betreff: Re: [PD] declare not posting library loading message while
object creation does?
Christof Ressi wrote:
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries
in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy
and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
but only if the external is within a given serach path on PD startup.
i guess Peter was saying that he only loads libraries/externals explicitly when they are needed. (which is a good practice for testing purposes or prior to posting/sharing patches)
in the case of [hid] (or [hidin] on windows) it would be [declare -path hid] though, since (as christof correctly said) it's a single external rather than a multiobject library (like ZEXY, IEMLIB, IEMMATRIX, GEM).
best
oliver
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Well, I think the best behavior is what Gem does. When one does [declare -lib Gem], the path is automatically added to search paths, so one can access all abstractions and help files without doing [declare -path Gem]. I know that it is still recommended to do [libname/libabstraction] when using abstraction libraries like [list-abs], instead of doing [declare -path list-abs], for clarity purposes.
But still, at least I think that 'declare' works in plain english like: [declare] == 'i will be using this library from now on, so load it entirely'. Of course the problem is that some libs are made of abstractions only, some of separated objects, and others are single binaries. How libs are made depends on the lib maintainer, not on pd, of course. So, if one does [declare -lib list-abs], indeed nothing happens, like [declare -lib hid].
Perhaps telling the user how to load the library could (also) be deken's job after downloading a library: a simple post to console to tell the user how to load the library based on the package contents...
On Mon, Oct 7, 2019 at 3:11 PM Christof Ressi christof.ressi@gmx.at wrote:
Hey,
but only if the external is within a given serach path on PD startup.
Which is also true for [declare -lib] - it can't magically find libraries without having the correct search paths. Note that for every external "foo" the loader also tries "foo/foo", so [declare -path hid] is not necessary, you can just do [hid]. I don't see any purpose for [declare -lib hid] except maybe for documentation (but then I would just write a comment).
i guess Peter was saying that he only loads libraries/externals
explicitly when they are needed.
I don't get it. When I do [hid] - without [declare -lib] -, it will be exactly loaded when needed.
Christof
Gesendet: Montag, 07. Oktober 2019 um 14:50 Uhr Von: "oliver" oliver@klingt.org An: Pd-list pd-list@mail.iem.at Betreff: Re: [PD] declare not posting library loading message while
object creation does?
Christof Ressi wrote:
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries
in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy
and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
but only if the external is within a given serach path on PD startup.
i guess Peter was saying that he only loads libraries/externals explicitly when they are needed. (which is a good practice for testing purposes or prior to posting/sharing patches)
in the case of [hid] (or [hidin] on windows) it would be [declare -path hid] though, since (as christof correctly said) it's a single external rather than a multiobject library (like ZEXY, IEMLIB, IEMMATRIX, GEM).
best
oliver
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Am 7. Oktober 2019 15:48:12 MESZ schrieb Federico Camara Halac camarafede@gmail.com:
Perhaps telling the user how to load the library could (also) be deken's job after downloading a library: a simple post to console to tell the user how to load the library based on the package contents...
i'm totally convinced that it is *impossible* (in the general case) to programmatically find out the correct way to load a library. so deken will need help from the creator of the package. but wait... deken already shows a README.deken.pd (or .html, or .txt) if present after installing a library. why not use that?
mfg.hft.fsl IOhannes
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
As oliver kindly pointed out yes I do only load libs when they are needed by the patch. And I do so with [declare -lib] to make it well visible and have all libs loaded at one spot in the patch. At this point I don't want to care about the single-object-lib versus multi-object-lib difference which is the reason I started this thread. [declare] sadly behaves differently for these two cases, a situation which I think should be improved in order to make lib loading easier for novices.
If you really want to prepare against multi-object-per-binary VS single-object-per-binary problems, you should do: [declare -path foo -lib foo]. This ensures that object "bar" in library "foo" can be created in both cases, as long as it's typed as [bar]. [foo/bar] doesn't (usually) work for multi-object-per-binary libs, but here's a PR which would solve that: https://github.com/pure-data/pure-data/pull/630
Maybe [declare -lib foo] could also add "foo" to the search paths. Then we would have a unified syntax for "loading" libraries and people wouldn't have to care about implementation details. Just thinking out loudly.
Christof
Gesendet: Montag, 07. Oktober 2019 um 15:56 Uhr Von: "Peter P." peterparker@fastmail.com An: pd-list@lists.iem.at Betreff: Re: [PD] declare not posting library loading message while object creation does?
- Christof Ressi christof.ressi@gmx.at [2019-10-07 14:38]:
And this was sarcasm too.
damn, my sarcasm-O-meter failed miserably...
I was using [declare -lib hid] because this is how I load libraries in general.
"-lib" is only needed for multi-object-per-binary libraries, e.g. zexy and iemlib. [declare -lib hid] doesn't do anything useful, the external will be loaded anyway when you create it the first time...
As oliver kindly pointed out yes I do only load libs when they are needed by the patch. And I do so with [declare -lib] to make it well visible and have all libs loaded at one spot in the patch. At this point I don't want to care about the single-object-lib versus multi-object-lib difference which is the reason I started this thread. [declare] sadly behaves differently for these two cases, a situation which I think should be improved in order to make lib loading easier for novices.
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Then we would have a unified syntax for "loading" libraries and people
wouldn't have to care about implementation details
That is also the goal of: https://github.com/pure-data/pure-data/pull/440