Forum: Ruby on Rails do you think we should make <%= # comment %> not cause error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb71c362ddeda80c2668d2575e97bc70?d=identicon&s=25 winter heat (winterheat)
on 2009-05-24 22:33
the code

  <% # some code %>

will not cause any error, but the code

  <%= # some code %>

will cause an error.

the argument is that the second statement is like

  output <<

and so it is an error.

But I think since

  puts "hello"

and

  puts

both can run and cause no error, why not make

  <%= # some code %>

not cause any error too?  If we have a language / platform that will
cause an error when we just comment out code, it is a big issue in the
long term, since usually when we comment out something, we won't easily
cause a problem and may have a hard time finding what the cause is.

for sure, we can change it to

  <% # some code %>

but we lose the note there that we were going to output the content.
When we uncomment the code, we don't know for sure whether it should be
<% %> or <%= %> and is prone to mistake again.
4375b4aca04b8d72482fd409fb6d0b47?d=identicon&s=25 Roderick van Domburg (roderickvd)
on 2009-05-24 22:35
Report it at http://rails.uservoice.com, I'd +1 it!

--
Roderick van Domburg
http://www.nedforce.com
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-05-24 22:44
(Received via mailing list)
I believe that <% #... %> is not a valid erb comment (no space is
allowed
after %). See
https://rails.lighthouseapp.com/projects/8994/tick....
You have to read through the comments to get to the conclusion.

Colin

2009/5/24 SpringFlowers AutumnMoon <rails-mailing-list@andreas-s.net>
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2009-05-24 22:58
(Received via mailing list)
In addition I meant to say that according to the ticket link, <%=# and
<%= #
are also not valid erb comments.
Colin

2009/5/24 Colin Law <clanlaw@googlemail.com>
C42c706fab23da0b6d3cd2cfbb8db27d?d=identicon&s=25 Salil Gaikwad (salil)
on 2009-05-27 07:19
Colin Law wrote:
> In addition I meant to say that according to the ticket link, <%=# and
> <%= #
> are also not valid erb comments.
> Colin
>
> 2009/5/24 Colin Law <clanlaw@googlemail.com>

I Commented code in erb in following ways

<%# This is Comment %>

<%#
 This is Comment
 %>

<%#= This is Comment %>

<%#=
This is Comment
 %>
Eb71c362ddeda80c2668d2575e97bc70?d=identicon&s=25 winter heat (winterheat)
on 2009-05-27 07:30
Salil Gaikwad wrote:

> I Commented code in erb in following ways
>
> <%# This is Comment %>
>
> <%#
>  This is Comment
>  %>
>
> <%#= This is Comment %>
>
> <%#=
> This is Comment
>  %>

i see.  that's smart.  then we don't need <%= #comment %> to work.  but
if it can, i think it might be good.
This topic is locked and can not be replied to.