On Jan 15, 2006, at 9:28 AM, Frank Barknecht wrote:
Hallo, Frank Barknecht hat gesagt: // Frank Barknecht wrote:
What I would be interested in more is being able to use $0 and other $x *literally*, for example to be able to dynamically create objects which use $0 as argument like:
[obj 100 100 f $0( | [s pd-subpatch]
to create a [f $0] in [pd subpatch] and not a [f 1001].
Ah, scrap that: Using "$0" this way in messages is not good, as it would be too different from how "$1,..." are used. Of course it's not possible nor useful to create a [f $1] by using "obj 100 100 f $1" This stuff needs proper escaping.
So what about this, which tries to keep a bit of backwards compatibility:
Object arguments change from $x to #x with x in 0(sic!),1,...,n
$x in objects are kept for a while for compatibility
Messages will get additional placeholders for canvas-properties, that start with a #hash and directly correspond to the object arguments from above. They will keep $-placeholders starting from 1(sic!) as in the past.
There will be no $0 anymore in the long run.
I personally don't like expanding Pd's syntax with the #, I think one of Pd's strength is minimal syntax.
$ args are expandable arguments, whether in objects or in messages. You can break down everything in Pd to those two basic categories: objects and messages. When you want an expandable argument, then use a $ arg. Since objects and messages are different things, it makes sense that $ args don't expand to the same thing within objects and messages. That seems nicely logical and compact to me. I think if people have trouble with that, they are likely not understanding the distinction between messages and objects rather than the $ args themselves.
But using the instance ID in messages would be a handy shortcut, so $$ could be the instance ID for both objects and messages without breaking anything AFAIK. It would make $ arg parsing perhaps more tricky, but I that code could be lifted from BSD's sh, for example, since its tried-n-true and released under a BSD license.
.hc
________________________________________________________________________ ____
"If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of everyone, and the receiver cannot dispossess himself of it." - Thomas Jefferson