[PD-dev] may have figured out scope

Jonathan Wilkes jancsika at yahoo.com
Tue Nov 20 00:37:26 CET 2012


----- Original Message -----

> From: IOhannes m zmölnig <zmoelnig at iem.at>
> To: pd-dev at iem.at
> Cc: 
> Sent: Monday, November 19, 2012 5:32 PM
> Subject: Re: [PD-dev] may have figured out scope
> 
> On 11/19/2012 09:28 PM, Jonathan Wilkes wrote:
>>  ----- Original Message -----
>>  What does [local foo] do different than [declare foo]? I assume with your
> 
> i would mainly object to [declare foo] because it seems to impose a hierarchy 
> between the things you can [declare] and pushing global/local namespaces to the 
> top, without any good reason.
> i'd thus go for something like [declare -localvar foo].

I don't care for the "-flag value" syntax.  So if Hans is suggesting [local foo]
to avoid that problem (or because he thinks its cleaner to have a new class
for this) then I prefer [local foo] to adding another flag to [declare].

> 
>>  I'm not removing $0-- as I said my solution is backwards compatible.  
> Replace
>>  canvas name ".xblah" with "$0" in what I wrote and it 
> works exactly the same.
> 
> you are talking a lot about "canvas", which in my understanding means, 
> that you could have a variable that is local to a subpatch. currently $0 is 
> local only to an abstraction and is shared between subpatches.
> is there a specific reason for this or is it just a slip of words?

No, there is a difference there in terms of subpatches, I just forgot about
that case.  I'm not sure exactly how Tim's method works, and whether you
could declare inside a subpatch (which would be handy, actually).  I'll go back
and re-read it.

> 
>>  One more question that applies to any system of scoping-- how do you apply 
> it
>>  to the message box?  I forgot about that aspect when I wrote the OP.
> 
> 
> for me "message local" applies to local for a specific message (that 
> is:
> [1, 2(
> |
> [$0-$1(
> could evaluate to "2352-1" and "4321-2".
> 
> i see little use to that, which is probably the reason why $0 doesn't expand 
> at all in messages.
> i also don't know exactly what the problem is you are envisioning. something 
> like that?
> <abstraction>
> [declare -localvar read]
> [; filereader read /tmp/bla.txt(
> [r filereader]
> |
> [textfile]
> </abstraction>
> and having two <abstraction/>s in your patch and clicking on the msgbox in 
> one of them resulting in "[textfile]: no method for local 
> 'read'" in the other???

I'm talking about scoping the symbols that pd binds to "things".

[; foo bar(

So I'm referring to "foo".  The remaining use for the [; foo] syntax that I see
is sending to a bunch of different send-names in one go-- for example, when
initializing a bunch of values in a patch with [loadbang]--[; foo 1; bar 2; etc.(

-Jonathan

> 
> fgasdr
> IOhannes
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev
> 



More information about the Pd-dev mailing list