[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Why not adopt "Python Style" indentation for Ruby?
From:       Stu <stu () rubyprogrammer ! net>
Date:       2013-11-30 18:12:51
Message-ID: CAHtto5ATYnmwyQe8Nr_Bq13G+38RFrk5KDw4E9LF6gQzUy8imA () mail ! gmail ! com
[Download RAW message or body]

It's interesting the terminators in ruby which are end, }, ||, && are all
basic syntax sugar for semi colon ;

The colon in python reveals that it's actually a syntax tree where the
colon probably saves the interpreter a single pass.

Both Ruby and Python have different philosophies. Pythonists enjoy the
concept of "one way" style which probably makes it easier to study other
programmers code simply because it looks the same as yours where Rubyists
enjoy the various programming styles which lack such restriction i.e. it
can look like anything which opens up many contexts which can be useful.

OP if you like the concept of restriction within ruby you are correct it
wouldn't be difficult to make simply because it won't stop you from doing
so but it may be difficult in getting your idea adopted simply because, as
I mentioned, ruby programmers enjoy having a programmable programming
language over just a general purpose one.

FWIW I helped a friend once with a simple hack to allow them to write
python with 2 spaces. Also nothing more than a small quick one-line hack to
make it work.



On Sat, Nov 30, 2013 at 4:38 AM, Marc Heiler <lists@ruby-forum.com> wrote:

> What I dislike about indent is that you need to satisfy the parser in
> order to make the program run.
>
> It's like an additional control element, like ';'.
>
> I do not think a language should care about indentation.
>
> With that having said, I concur with the initial statement - "end" does
> not give me, as a programmer, meaningful information. I only have to use
> it to satisfy the ruby parser - in python, you can omit that, but you
> (a) must then indent properly (which is, again, to satisfy the parser)
> and (b) you have to use the strange ':', which is annoying.
>
> What I would love to have, however, would be a per-file option that
> would allow me to omit end for a given .rb file. Just like shebang or
> encoding lines could be used.
>
> I could then write specific classes in a single .rb file (one class per
> file) and they would be more readable too.
>
> --
> Posted via http://www.ruby-forum.com/.
>

[Attachment #3 (text/html)]

<div dir="ltr"><div><div><div><div>It&#39;s interesting the terminators in ruby which \
are end, }, ||, &amp;&amp; are all basic syntax sugar for semi colon \
;<br><br></div>The colon in python reveals that it&#39;s actually a syntax tree where \
the colon probably saves the interpreter a single pass.<br> <br></div>Both Ruby and \
Python have different philosophies. Pythonists enjoy the concept of &quot;one \
way&quot; style which probably makes it easier to study other programmers code simply \
because it looks the same as yours where Rubyists enjoy the various programming \
styles which lack such restriction i.e. it can look like anything which opens up many \
contexts which can be useful.<br> <br></div>OP if you like the concept of restriction \
within ruby you are correct it wouldn&#39;t be difficult to make simply because it \
won&#39;t stop you from doing so but it may be difficult in getting your idea adopted \
simply because, as I mentioned, ruby programmers enjoy having a programmable \
programming language over just a general purpose one.<br> <br></div>FWIW I helped a \
friend once with a simple hack to allow them to write python with 2 spaces. Also \
nothing more than a small quick one-line hack to make it work. \
<br><div><div><div><br></div></div></div></div><div class="gmail_extra"> <br><br><div \
class="gmail_quote">On Sat, Nov 30, 2013 at 4:38 AM, Marc Heiler <span \
dir="ltr">&lt;<a href="mailto:lists@ruby-forum.com" \
target="_blank">lists@ruby-forum.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> What I dislike about indent is that you need to satisfy the \
parser in<br> order to make the program run.<br>
<br>
It&#39;s like an additional control element, like &#39;;&#39;.<br>
<br>
I do not think a language should care about indentation.<br>
<br>
With that having said, I concur with the initial statement - &quot;end&quot; does<br>
not give me, as a programmer, meaningful information. I only have to use<br>
it to satisfy the ruby parser - in python, you can omit that, but you<br>
(a) must then indent properly (which is, again, to satisfy the parser)<br>
and (b) you have to use the strange &#39;:&#39;, which is annoying.<br>
<br>
What I would love to have, however, would be a per-file option that<br>
would allow me to omit end for a given .rb file. Just like shebang or<br>
encoding lines could be used.<br>
<br>
I could then write specific classes in a single .rb file (one class per<br>
file) and they would be more readable too.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Posted via <a href="http://www.ruby-forum.com/" \
target="_blank">http://www.ruby-forum.com/</a>.<br> \
</div></div></blockquote></div><br></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic