#87 $arg-expansion gives error with old patches

v0.40.1
open
puredata (318)
5
2006-10-09
2006-10-09
No

with the advent of the new and better $arg-expansion
(namely: expansion of $args _within_ an argument, like
bla-$2-blu), old patches (<0.40) that used dollars
within symbols are somewhat broken.

example1: iemlib provides an object [parentdollarnull]
with an alias [parent$0]; the latter gets expanded
(e.g. to [parent1003]) and cannot be created.
THIS IS NO BUG (imho)
however, $0 is not only expanded on a logic level, but
also on a visible level (i really see [parent1003]);
this i believe IS a bug.

example2 (more important!): in the olde times, if a
symbol contained dollars within, it was saved (in the
.pd file) like "bla-$2-blu".
in pd=0.40.0, the same symbol gets saved as
"bla-\$2-blu" (note the backslash).
loading an old abstraction yields an error ("argument
out of range"), even if enough arguments (in this case:
2) are supplied.
the expansion works correctly though!
imho, either the warning should be supressed or the old
behaviour (no expansion) should be preserved.

(it would be good if the pd-version at the time of
saving would be stored in the .pd-fileformat in order
to allow such things)

this little script should replace all "$<n>" with a
missing backslash at the beginning with "\$<n>"

find . -name "*.pd" | while read f
do
sed -i -e 's|\([^\\]\)\$|\1\\$|g' $f
done

note on the script: i haven't done excessive testing,
but it seems to work; make backups before you apply it,
since it will change all affected files without asking)

note: it seems like old versions (tested with
pd-0.39-2) seem to be able to correctly read files
saved with pd-0.40-0

Discussion

  • Logged In: YES
    user_id=801174

    PureUnity uses dollar-expansion in class names, so an
    exception cannot be made for class names, especially because
    PureUnity has no other way to implement its feature set.

    I call this feature "abstraction templates" or "class
    templates": [f.swap], [~.swap], [#.swap] are like
    swap<float>, swap<signal>, swap<grid> would be in C++.

     
  • Logged In: YES
    user_id=564396

    sorry if i was unclear here: dollar-expansion in class-names
    is a feature that i would _hate_ to miss. i think it is
    really important to do any thing more complex. (that is why
    i wrote in HUGE letters that i do not consider this a bug).
    the problem described is rather a bug in the iemlib (it
    shouldn't have used a name like [parent$0] in the first place.)

    however, i do think it a bug, that the classname [parent$0]
    is replaced by [parent1001] (literally!)

    the main bug report here was about pd-0.40 not being able to
    read older patches (created with pd-0.39) without an
    error-message.

     


Anonymous


Cancel   Add attachments