Regarding parentheses-- Gridflow adds a syntax like that for handling
nested message data. I don't like the idea in general, but I like Gridflow's
implementation better than your example because it doesn't require
space in between the parentheses and the data itself.
Anyhow, this is another parser change (in m_binbuf).
> == NAMED ARGUMENTS ==
> [myabs freq=440 vol=1]
> inside the abstraction:
> $freq would evaluate to '440'
> $vol would evalute to '1'
> If a certain argument is not specified as creation argument, it would
> evaluate to '0' (similar to existing behavior).
What would $1 and $2 evaluate to in this case? What would [$freq( expand to?
I'm not actually sure what changes this would require. At the very least you'd need a
new case in the parser for handling dollar signs that don't match the A_DOLLAR or
A_DOLLSYM. It seems like you'd need a new atom type, too. Let's call it
A_DOLLVAR.
How does A_DOLLVAR interact with A_DOLLSYM and A_DOLLAR? Can it be
concatenated with them? (The case for "$@" is that it doesn't concatenate.) But
you also have to account for A_DOLLVAR expanding to arbitrarily-deeply-nested
lists because it's going to work inside message boxes, too.
> == USE CASE ==
> [oscformat] takes an arbitrary number of arguments to create an OSC
> address. While I find this the cleaner and more pd-like way than
> /one/two/three, this has big draw-back. You currently cannot pass the
> OSC address (containing an arbitrary number of address fields) to an
> abstraction when using [oscformat]. The number of arguments must known
> beforehand when using this format. With [packOSC] from the osc library,
> you can do:
> [myabs /base/address]
> and therein:
> [packOSC $1/freq]
> which evaluates to /base/address/freq.
> By allowing grouping of arguments, one could achieve the same without
> resorting to long symbols (which has other drawbacks). In the main
> patch you could create:
> [myabs ( base address )]
> and therein:
> [oscformat $1 freq]
> and [oscformat] would actually see 'base address freq'.
Wouldn't it see '(base address) freq'?
> There are many other cool things you could do. It would allow to create
> lists of lists, which can be easily split again later (which is
> currently very hard to do and involves a lot of serializing and using
> delimiters or prepended number-of-elements). Generally, it would allow
> to create much more flexible abstractions.
Does [text] address some of this?
> Any feedback welcome.
> Roman
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list