[PD-dev] representing parent patch levels as args

Hans-Christoph Steiner hans at eds.org
Mon Dec 8 23:59:49 CET 2008

On Dec 8, 2008, at 12:21 PM, Claude Heiland-Allen wrote:

> Hans-Christoph Steiner wrote:
>> So I am just adding support to canvas_name and window_name for   
>> getting the names from other canvases besides the current one,  
>> i.e.  parent, toplevel, etc.
> OK.
>> I am using the now standard numeric notation  that is used in  
>> [getdir], iemguts, getdollarzero, etc.
> Care to give a brief description of that for those that don't  
> know?  I'd be interested in adding something similar to pdlua, so  
> that .pd_lua(x) files can access the path(s) of their containing  
> patch(es), would make sense to have the same numbers.

0 = current patch
1 = parent
2 = parent's parent

One question I have is about the behavior when you specific more  
levels than exist.  Like [canvas_name 999999].  Should that be an  
error, warning?  Should it give the toplevel? nothing?  I am guessing  
it should give the toplevel, with a warning.

>> What I am wondering is whether it is worth it to add symbol  
>> versions  of those names too, like "parent" and "toplevel".
> this sounds useful at first, but if it's only two cases then maybe  
> it's not worth the hassle...

Those are the two that will be most commonly used, IMHO, so it could  
be worth using.

>> Or perhaps it  would also be useful to be able to stick the name  
>> of a canvas there  too, like 'pd-mysubpatch' or 'pd-canvas_name- 
>> help.pd'.
> Err, why would that be useful if the object is to get the name in  
> the first place (and also, what happens if there are 42 copies of  
> canvas_name-help.pd open...?)

Currently you get "warning: pd-canvas_name-help.pd: multiply defined"  
and they all return the first instance of canvas_name-help.pd.  That  
seems appropriate to me.

>> What are  people's thoughts on making that part of the standard  
>> technique of  looking up these kinds of things?
> I think often numbers are nicer than names (eg, I'd hate to have to  
> type "greatgreatgreatgrandparent" instead of 5 or whatever it would  
> be).

Agreed, I think a limited set of names, like "parent", "toplevel" and  
maybe "current" just to make things explicit.  I forgot I had already  
implemented this, except for the "parent" and "toplevel" part:



> Claude
> -- 
> http://claudiusmaximus.goto10.org


Man has survived hitherto because he was too ignorant to know how to  
realize his wishes.  Now that he can realize them, he must either  
change them, or perish.    -William Carlos Williams

More information about the Pd-dev mailing list