[PD-dev] the future of [declare] and canvas_savedeclarationsto()

Hans-Christoph Steiner hans at eds.org
Tue May 20 17:20:01 CEST 2008


On May 20, 2008, at 3:43 PM, marius schebella wrote:

> Hans-Christoph Steiner wrote:
>> On May 20, 2008, at 8:54 AM, Frank Barknecht wrote:
>>> Hallo,
>>> Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
>>>
>>>> I think this issue is pretty clear, and the languages that I know
>>>> would fall along the lines of "each patch/abstraction has its own
>>>> namespace" or in other words "#include only affects the one .c
>>>> file",  "import only affects the one .py file", etc.  So I agree  
>>>> with
>>>> Frank.  Global settings are global, and canvas-local settings are
>>>> local to the original file.
>>> I think, it's not yet "pretty clear" at all otherwise we wouldn't
>>> discuss this issue so often. Here are some random thoughts on the
>>> topic.
>>>
>>> The languages you mentioned have something like a scope, they know
>>> global and local variables. In Pd, everything is global and there is
>>> no local scope as far as I can see. Even $0 evaluates to a global
>>> value, that is easily accessed from the outside of an  
>>> abstraction. So
>>> you cannot just take a concept from, say, Python and include it
>>> one-to-one in Pd - it has to be adapted. (Also Pd has more in common
>>> with LISP or Lua than with C or Python IMO, so we should look there
>>> first.)
>> I don't know Lisp or Lua, so I can't speak to that.  Please do  
>> give  examples.  Basically, I think that every objectclass should  
>> have its  own namespace.  That fits into the core idea of  
>> objectclasses being  distinct, reusable modules of code.  If the  
>> parent patch affects an  abstraction, that makes the objectclass  
>> dependant on the parent  patch, which is not a good thing.
>
> but if you use an abstraction inside another object, then all the  
> variables of the parent patch should be available in the  
> abstraction. additionally the local variables of the subpatch have  
> higher priority and can overwrite the settings of the parent patche.
>
> object1 declares to use urn from cycling
> -- by default all abstractions created inside object1 would also  
> use urn from cycling, except if an abstraction declares to use urn  
> from zexy.

This is exactly what I think would be a bad idea, then the  
objectclass/abstraction depends on the parent patch. Therefore the  
abstraction's/objectclass' functionality could change depending on  
which parent patch it was used with.

If this kind of functionality was really desired, there could be  
namespaces like in Tcl which could be imported on their own.  But  
this would add a lot complexity with little gain, IMHO.

.hc

>>> Currently [declare] modifies global settings like path and loaded
>>> libraries, that you normally modify outside of a patch with
>>> .pdsettings/.pdrc or command line options. That's simple and  
>>> beautiful
>>> at first, but has the ugly side effect of conflicting declares, that
>>> need to be resolved. Having the toplevel [declare] win over other
>>> declarations is simple as well, but not that beautiful anymore as it
>>> makes writing abstractions more error prone because they cannot rely
>>> anymore  on their own declarations being valid. So in the end I'd
>>> agree with you that we would (also?) need a way to modify  
>>> settings in
>>> a non-global way. As far as I see it, we'd have two places for doing
>>> this: We could use a restricted scope for such declarations either
>>>
>>>  a) per abstraction i.e. in a region where $0 is equal.
>>>  b) per subpatch: [pd zexy-is-loaded-here]
>>>
>>> It could also be realised with messages sent to "pd-subname", but
>>> that's probably not a good idea because of execution order problems.
>>> Or is it?
>> [declare -std*] modifies the global namespace [declare] with -lib  
>> and  -path modify the canvas-local namespace.
>
> I think "std" is misleading naming here! see the help file for  
> declare.
> std here means that the path is relatice to the pd bin directory,  
> it has nothing to do with global or local.
> marius.



------------------------------------------------------------------------ 
----

I spent 33 years and four months in active military service and  
during that period I spent most of my time as a high class muscle man  
for Big Business, for Wall Street and the bankers.      - General  
Smedley Butler






More information about the Pd-dev mailing list