[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Why not adopt "Python Style" indentation for Ruby?

Yukihiro Matsumoto

5/18/2007 7:38:00 AM

Hi,

In message "Re: Why not adopt "Python Style" indentation for Ruby?"
on Fri, 18 May 2007 16:25:03 +0900, Chris Dew <cmsdew@googlemail.com> writes:

|What are the reasons why this isn't used/implemented/liked?

Python style block by indentation is an interesting idea, but it works
badly with

* tab/space mixture
* templates, e.g. eRuby
* expression with code chunk, e.g lambdas and blocks

So I'd rather be conservative here.

matz.

49 Answers

Michal Suchanek

5/18/2007 9:05:00 AM

0

On 18/05/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Why not adopt "Python Style" indentation for Ruby?"
> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew <cmsdew@googlemail.com> writes:
>
> |What are the reasons why this isn't used/implemented/liked?
>
> Python style block by indentation is an interesting idea, but it works
> badly with
>
> * tab/space mixture
> * templates, e.g. eRuby
> * expression with code chunk, e.g lambdas and blocks
* clipboards, email, pastebins, and other places where the code is not
preserved literally

Thanks

Michal

Xavier Noria

5/18/2007 9:09:00 AM

0


On May 18, 2007, at 11:04 AM, Michal Suchanek wrote:

> On 18/05/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
>> Hi,
>>
>> In message "Re: Why not adopt "Python Style" indentation for Ruby?"
>> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew
>> <cmsdew@googlemail.com> writes:
>>
>> |What are the reasons why this isn't used/implemented/liked?
>>
>> Python style block by indentation is an interesting idea, but it
>> works
>> badly with
>>
>> * tab/space mixture
>> * templates, e.g. eRuby
>> * expression with code chunk, e.g lambdas and blocks
> * clipboards, email, pastebins, and other places where the code is not
> preserved literally

code generators

cies

5/18/2007 10:51:00 AM

0

* tab/space mixture
* templates, e.g. eRuby
* expression with code chunk, e.g lambdas and blocks
* clipboards, email, pastebins, and other places where the code is not
preserved literally
* code generators

tabs can be made forbidden (g.v.rossum himself said he'd never
supported tabs in the first place if he new what it would cauze)

maybe it can be made optional. or one could write a little conversion script.

i agree python's indentation looks clean. yet i have experienced
allmost all of the above mentioned "cons"...

_c.


On 5/18/07, Xavier Noria <fxn@hashref.com> wrote:
>
> On May 18, 2007, at 11:04 AM, Michal Suchanek wrote:
>
> > On 18/05/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> >> Hi,
> >>
> >> In message "Re: Why not adopt "Python Style" indentation for Ruby?"
> >> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew
> >> <cmsdew@googlemail.com> writes:
> >>
> >> |What are the reasons why this isn't used/implemented/liked?
> >>
> >> Python style block by indentation is an interesting idea, but it
> >> works
> >> badly with
> >>
> >> * tab/space mixture
> >> * templates, e.g. eRuby
> >> * expression with code chunk, e.g lambdas and blocks
> > * clipboards, email, pastebins, and other places where the code is not
> > preserved literally
>
> code generators
>
>

Xavier Noria

5/18/2007 10:56:00 AM

0

On May 18, 2007, at 12:50 PM, cies wrote:

> * tab/space mixture
> * templates, e.g. eRuby
> * expression with code chunk, e.g lambdas and blocks
> * clipboards, email, pastebins, and other places where the code is not
> preserved literally
> * code generators
>
> tabs can be made forbidden (g.v.rossum himself said he'd never
> supported tabs in the first place if he new what it would cauze)
>
> maybe it can be made optional. or one could write a little
> conversion script.

Or add source filters:

http://search.cpan.org/~fxn/Acme-Pythonic-0.45/lib/Acme/P...

MWUUAHAHAHA.

-- fxn


Brian Candler

5/18/2007 12:31:00 PM

0

On Fri, May 18, 2007 at 06:09:23PM +0900, Xavier Noria wrote:
> >>|What are the reasons why this isn't used/implemented/liked?
> >>
> >>Python style block by indentation is an interesting idea, but it
> >>works
> >>badly with
> >>
> >> * tab/space mixture
> >> * templates, e.g. eRuby
> >> * expression with code chunk, e.g lambdas and blocks
> >* clipboards, email, pastebins, and other places where the code is not
> >preserved literally
>
> code generators

Disabling sections of code, i.e.

if false
...
... code with original indentation
...
end

Also, multi-level namespaces where you don't want to indent the entire
source file that much, e.g.

module Foo
module Bar
class Baz
def wibble
...
end
end # Baz
end # Bar
end # Foo

(Admittedly, I believe it's now possible to write

module Foo; module Bar; end; end
class Foo::Bar::Baz
...
end)

S.Volkov

5/18/2007 2:13:00 PM

0

"Yukihiro Matsumoto" <matz@ruby-lang.org> wrote in message
news:1179473895.694681.23173.nullmailer@x31.netlab.jp...
> Hi,
>
> In message "Re: Why not adopt "Python Style" indentation for Ruby?"
> on Fri, 18 May 2007 16:25:03 +0900, Chris Dew <cmsdew@googlemail.com>
> writes:
>
> |What are the reasons why this isn't used/implemented/liked?
>
> Python style block by indentation is an interesting idea, but it works
> badly with
>
> * tab/space mixture
> * templates, e.g. eRuby
> * expression with code chunk, e.g lambdas and blocks
>
> So I'd rather be conservative here.
>
> matz.

imho: indentation should not define semantic;
suggestion: make 'end' optional if code block contains only one statement;

BRs
Sergey Volkov


Jaroslaw Zabiello

5/18/2007 3:10:00 PM

0

Dnia Fri, 18 May 2007 16:38:05 +0900, Yukihiro Matsumoto napisa3(a):

> Python style block by indentation is an interesting idea, but it works
> badly with
>
> * tab/space mixture

Tabs are against PEP8 which recomends space usage only.

> * templates, e.g. eRuby

eRuby is crap if you compare it with Haml template
http://haml.hamptonc....

It is interesting how they use indendation and how clean it can be. And
finally... they are written in Ruby and for Ruby users! :)

What do you think about OPTIONAL block indendation in Ruby?

--
Jaros3aw Zabie33o
http://blog.za...

Gregory Brown

5/18/2007 3:26:00 PM

0

On 5/18/07, Jaroslaw Zabiello <hipertracker@gmail.com> wrote:

> > * templates, e.g. eRuby
>
> eRuby is crap if you compare it with Haml template
> http://haml.hamptonc....

Except eRuby is a general templating system, and Haml is for XHTML generation.

Jaroslaw Zabiello

5/18/2007 4:02:00 PM

0

Dnia Sat, 19 May 2007 00:26:15 +0900, Gregory Brown napisa3(a):

> Except eRuby is a general templating system, and Haml is for XHTML generation.

It is not true. Haml can generate non valid XML content as well. But it is
true that Haml main target is XHTML and CSS generation. For CSS generation
is Sass which uses very similiar approach
http://haml.hamptoncatlin.com...

Is it not strange that such solution was invented
by Ruby, not Python, guys? :)

--
Jaros3aw Zabie33o
http://blog.za...

Austin Ziegler

5/18/2007 4:17:00 PM

0

On 5/18/07, Jaroslaw Zabiello <hipertracker@gmail.com> wrote:
> > * templates, e.g. eRuby
> eRuby is crap if you compare it with Haml template
> http://haml.hamptonc....

How well does Haml work with non-HTML templating?

-austin
--
Austin Ziegler * halostatue@gmail.com * http://www.halo...
* austin@halostatue.ca * http://www.halo...feed/
* austin@zieglers.ca