On May 20, 2008, at 2:12 PM, Frank Barknecht wrote:
Hallo, Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
[declare -std*] modifies the global namespace [declare] with -lib and -path modify the canvas-local namespace.
Not according to the help-file for declare, where the only difference between the options with "std" and those without is how the arguments are evaluated: "relative to the patch" for the naked, "relative to Pd" for the "std"-decorated versions of the options. There's nothing about scope in the help file (and I'm currently not taking into account how declare works in reality, as that is deliberatly restricted in 0.41)
I got it a bit mixed up the first time, -lib and -stdlib change the canvas-local path, and -path and -stdpath change the global path. According to the C code, that is what it does. Check out canvas_declare(), starting at line 1478:
http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/pd/src/ g_canvas.c?view=markup
This means append to the canvas-local search path(e->ce_path):
e->ce_path = namelist_append(e->ce_path, strbuf, 0);
.hc
Tcl has namespaces that can be used across procedure/class, provided you import them into procedure/class. I suppose Pd could have that too, so you could set dependencies across a whole project. But I don't see this as being especially useful in Pd, and it would add complexity.
If I write an objectclass (aka abstraction), I only want to have to think about what libs that objectclass needs. I don't want to think about how those libs related to other files in the project at that point. Having the local namespace per objectclass/abstraction allows for this.
Agreed. But it seems that's not what [declare] does ATM or was intended to do when Miller wrote it, while [import] was designed to do it, IIR. Lets not confuse the two.
Ciao
Frank Barknecht
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
------------------------------------------------------------------------ ----
Access to computers should be unlimited and total. - the hacker ethic