At Wed, 2 Oct 2002 22:22:27 +0900, William Djaja Tjokroaminata wrote: > As Ruby already has "sprintf", is this new syntax just a shortcut for > sprintf, or is it supposed to behave differently (just like the > discussion of to_flt vs. to_f)? The former. One can define String#% as follows: class String def %(arg) return sprintf(self, *arg) if arg.is_a?(Array) sprintf(self, arg) end end Ruby's operator syntax is a special invocation form of method. We have an equation `str % arg == str.%(arg)' for any str and arg. > Also, in > > "format_strings" % tokens_of_more_than_one_objects > > what will be the syntax for tokens_of_more_than_one_objects? Will > parentheses be optional? Will it be able to take an array? The reason I > ask is because in Python tokens_of_more_than_one_objects must be a tuple, > which Ruby does not have. Ruby uses array instead of tuple. -- Gotoken