From: Mathieu Bouchard Date: 2002-01-12T00:51:55+09:00 Subject: Re: The * operator... On Fri, 11 Jan 2002, Sean Chittenden wrote: > What's the * operator called when used in a method's arguments? > foo( ['asdf','zxcv','qwer']) # Will pass one arg > foo(*['asdf','zxcv','qwer']) # Will pass three args > What class is the * method apart of, and what's it called? Silly > little question, but I haven't seen any references to its name. <:~) I would say that this unary * is not an "operator", or at least, not at all like the other operators, because *x is not an expression. i'd call * the Rest Prefix, but this is how *I* see the thing, and is somewhat influenced by CommonLisp. In CommonLisp, you'd write def x(a,*b)...end as (defun x(a &rest b)...) Where &rest is a special symbol known that only defun understands. In RubySchema.rb (my proposed object system for ruby code), "Rest" doesn't have its own class, and instead is considered an attribute in several kinds of objects, like Multiple-expressions, Multiple-variables, DefMethods, Messages, Super, Array-literals, ... ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju