"David Alan Black" <dblack / wobblini.net> schrieb im Newsbeitrag news:m3vfi98ggu.fsf / wobblini.net... > > Note (from David Black): This was a message sent by Botp to ruby-talk > that didn't make it through. I resent it, with a small change, to see > if it would make it, and it did. > > The change was to strip "Re:" and put "about" in the subject line.... I assume this is a stupid question, but the GW doesn't contain a header detection regexp that looks like this: /^(.*):\s+(.*)$/ >> /^(.*):\s+(.*)$/ =~ 'Subject: Re: foo bar' => 0 >> $1 => "Subject: Re" >> $2 => "foo bar" Really stupid question... robert > > "Peñá, Botp" <botp / delmonte-phil.com> writes: > > > GGarramuno / aol.com [mailto:GGarramuno / aol.com] wrote: > > > > > nobu.nokada / softhome.net wrote in message > > > news:<200406020151.i521pOHY005774 / sharui.nakada.niregi.kanuma. > > > tochigi.jp>... > > > > Hi, > > > > > > > > At Wed, 2 Jun 2004 03:43:42 +0900, > > > > Sam Sungshik Kong wrote in [ruby-talk:102028]: > > > > > s = "My name is %(name)s and my age is %(age)d." % > > > {"name": "Sam", > > > > > "age": 34} > > > > > > > > > I know that ruby has "#{name}" expression. > > > > > But that requires a variable named "name" in advance. > > > > > I want to bind the format string and data later. > > > > > > > > I proposed that feature once in [ruby-dev:16351], though > > > rejected, but > > > > still I think that it would be useful for I18N. Is it worth for RCR? > > > > > > Do you have an example on how would you use this? I ask > > > because I would also vote strongly against it. > > > > > > One of the things that I really loved about ruby while > > > learning it was its "#{}" syntax, as it seemed to me a much > > > more consistent way of achieving what sprintf, $, %, etc. > > > have been trying for years to achieve in languages like C, > > > perl, python, etc. > > > > > > [snip good examples] > > > The %s syntax is anything but readable once you have more > > > than 3 elements. Using a hash to try to clarify it seems to > > > me more of a crutch for languages that do not support ruby's > > > extremely powerful "#{}" formating. That syntax still forces > > > me to look for meaning of the text format string in two > > > different places (in the location of the text and at the end > > > of it), instead of in a single place as I read the string, > > > which seems like a step backwards overall. > > > > > > I think the op implied late binding or late generation of string and > > variables/hashes. I think ruby can do this w finesse, so we've seen examples > > of workarounds immediately posted (thanks guys, I learned a lot here). > > > > Thus > > given foo_string % foo_hash, one can generate foo_string anytime one > > wants and just tells it to "Hey foo_string, get your values from foo_hash". > > foo_hash of course may contain a lot of key-val pairs. We need not > > care/worry of the order or counts of the vars since the foo_string will just > > pickup what it wants. > > > > This style is also good for structures and records in db, imho. > > > > I hope I was thinking straight here. Pls correct me guys if I'm wrong. > > In this regard, I vote for Nobu's rcr. > > > > kind regards -botp > > > > > > > > > > -- > -- > David A. Black > dblack / wobblini.net