From: Robert Klemme Date: 2009-08-25T17:21:35+09:00 Subject: Re: operators vs. methods 2009/8/25 Sarah Allen : > 7stud -- wrote: >> Ruby gives you a choice with some methods, like +() and =(), to use a >> special syntax.  Special syntaxes are commonly known as "syntactic >> sugar".   What happens is that the "sugared syntax" is converted into >> the normal method call, so: >> >> 1 + 2  becomes 1.+(2) >> >> and >> >> obj.x = 10 becomes obj.x=(10)  (where the method name is 'x=') > > So, where might I find a list of the special sugary methods? There is a list in the printed edition of the Pickaxe IIRC. > and may I > define my own?  I know I can override + and =, but could I make ß or foo > be sent to an object with syntax such as 4 foo 4 or "test"ß"this" ?  (I > don't know that I would want to, but I am curious) You cannot as that would mean changing of the language's syntax. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/