Patches item #1543850, was opened at 2006-08-21 03:24 Message generated for change (Comment added) made by eighthave You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1543850...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: wishlist Status: Open Resolution: None Priority: 5 Private: No Submitted By: IOhannes m zmölnig (zmoelnig) Assigned to: Miller Puckette (millerpuckette) Summary: $@ and $# expansion (argc, argv)
Initial Comment: the attached patch extends the $-expansion mechanism:
$# expands to the number of arguments; usable both as A_DOLLAR (just "$#") and A_DOLLSYM ("$#-bla")
$@ expands to the entire list of arguments (e.g. [$@ $@( will expand [1 2 3( to [1 2 3 1 2 3(); this is only usable as A_DOLLAR; i.e. [symbol $@-a( will always expand to "$@-a"
why: well, its a way to deal with dynamic length lists that is still missing in pd (though 1st steps have been made with [list])
caveats: what is still missing is an expansion for the selector of messages and objects (the selector of an object would be the object's instantation name); would $$ be a good name for this? (since $0 is already taken)
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2012-10-11 09:01
Message: This is included in Pd-extended 0.43
----------------------------------------------------------------------
Comment By: Mathieu Bouchard (matju) Date: 2007-01-12 21:24
Message: Logged In: YES user_id=801174 Originator: NO
i think that $@ is what is necessary to allow abstractions to do what they want with args, and that $# is not so useful in comparison, and what would be more useful than $# (in the sense of avoiding more detours) would be to be able to do a $@-like thing that only starts at the Nth argument, e.g. if I have an abstraction that takes $1 $2 $3 and then a variable number of arguments, and those arguments starting with $4 are to be all written directly in an objectbox. witness the strange stuff going on in [nqpoly]...
----------------------------------------------------------------------
Comment By: IOhannes m zmölnig (zmoelnig) Date: 2007-01-02 10:52
Message: Logged In: YES user_id=564396 Originator: YES
updated for current CVSversion of pd (2007-01-02) File Added: dollargcargv.patch
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave) Date: 2006-08-22 15:21
Message: Logged In: YES user_id=27104
Yes! This is great!
As for the selector, $0 is not taken in message space, so I think it makes sense there. Since message expansion variables are already different than object arguments, I think that won't be too confusing. Plus the $ variable syntax comes from shell scripting, where $0 is basically the selector of the message that is the command line arguments.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1543850...