From: "David A. Black" Date: 2008-04-29T20:16:26+09:00 Subject: Re: Sprintf: what does mean the percent symbol? --1926193751-752046638-1209467786=:20501 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-752046638-1209467786=:20501" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-752046638-1209467786=:20501 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Tue, 29 Apr 2008, Robert Klemme wrote: >> I've searched on the ruby pickaxe and several other ruby books but I >> haven't found anything on the % alone, obviously there are many use of >> that combined with option (array: %w, string: %q,%Q, regexp: %r, ...). > > That's a completely different story, here % I would not call "operator"= =20 > because it is not runtime effective. This occurrence of the percent sign= is=20 > evaluated at compile time, more precisely during parsing. All these are= =20 > convenience syntaxes to more easily express certain literals. For exampl= e,=20 > if you have a regular expression containing forward slashes the %r form i= s=20 > much easier on the eye: > > %r{/+} vs. /\/+/ But not the brain :-) I know there's no consensus about these things, but I'll just put in a word for //. Having trained my brain to understand /\/+/ at a glance, I always find it much harder to understand things like {/+}, and similarly with /x-style regexes, which I always have to slow down to read. Chacun =C3=A0 son cerveau :-) David --=20 Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin INTRO TO RAILS June 24-27 London (Skills Matter) See http://www.rubypal.com for details and updates! --1926193751-752046638-1209467786=:20501-- --1926193751-752046638-1209467786=:20501--