From: Eric Hodel Date: 2005-07-17T10:46:48+09:00 Subject: Re: delaying string evaluation On 16 Jul 2005, at 08:34, Navindra Umanee wrote: > Eric Hodel wrote: > >> s = "#{expanded} %s" >> s = s % delayed >> > > If there are multiple occurrences of delayed, you have to repeatedly > apply it in the second line in proper order, and if you have any > independent occurrence of % in the string, I'm not entirely sure how > to escape it. This solution isn't very symmetric either. Yes :( >> I think the reeval thing is the wrong way to go about it. > > What do you have against reeval? I have been trying to convince > myself there are better solutions, but after looking I keep coming > back to it. It just seems more natural or at least it works as a > general solution. I find \#{} hard to read because I have to think about it. (It also feels very funny.) >> or from a template than to try fancy substitution tricks (unless its >> really small). Eventually you end up with either a template language >> or programatic HTML generation in the end. > > I agree that this is what I will end up with -- I'm just trying to get > it to work in the most elegant way I can. > > What do you use? I've never used Amrita, and I've found CGI lacking. Rails' use of erb is very nice, I've used (and extended) RDoc's template system and ported one from Seaside which was CGI-like, but felt better. The biggest problem with CGI is that it does everything you want out- of-the-box in an ugly way, and nobody seems to wrap up fragments into methods that act as templates. CGI used this way would be much more palatable. See also http://raa.ruby-lang.org/search.rhtml?search=template Its so easy to write a proper one that everybody does it! It seems to be the second Ruby project everyone uses. -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04