On Sep 28, 2007, at 09:20 , SpringFlowers AutumnMoon wrote:
> I like Ruby tremendously...
>
> and currently having some headache with the "$" and ";" in PHP, like
>
> $i = $j;
>
> in every single line, vs Ruby's simplicity
>
> i = j
>
> maybe the $i is so that outputting the variable is easy in
>
> print "the value is $i"
> in ERb, we need to write
>
> "the value is #{i}"
>
> and it is a bit more typing.  can we have something like
>
> "the value is ##i"  as a shorthand? and use #{ } when it involves more
> complicated expressions?

There is a shortcut for ivars, cvars and globals, but I find it too  
evil to write down.  Especially since it can lead to mysterious  
syntax errors when you're not paying attention.  I'm sure you'll find  
it soon enough.

> The other thing is that in PHP, they use "print" and "echo" to output
> the HTML code.  In Ruby, we always use <%=  evaluated_value  %>   
> and it
> might have a limit of always breaking up the code into  <%  %>  and  
> <%=
> %> and <% %>
>
> <% results.each do |k,v| %>
> <%= "#{k}  #{v}" %>
> <% end %>
>
> the people who like to use inject may be happy because they can  
> have it
> all in one line  <%= results.inject {|k,v| k += ... %>
>
> but if we can have some way that the STDOUT is made into HTML code,  
> like

This should be easy enough to do by overwriting $stdout with an  
object that writes to _erbout (or whatever it is) while in an erb  
template.