Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Pythonic indentation (or: beating a dead horse)

Reply
Thread Tools

Pythonic indentation (or: beating a dead horse)

 
 
Eric Hodel
Guest
Posts: n/a
 
      05-20-2009
On May 19, 2009, at 16:58, Benjamin Kudria wrote:

> On Tue, May 19, 2009 at 19:49, Eric Hodel <>
> wrote:
>> Does anybody complain about terminating '}' in C, C++ or Java?

>
> Python programmers?
>
>
>
>> Does anybody
>> complain about terminating '.' on sentences? (There's a following
>> capital
>> letter for disambiguation!)

>
> I agree with your point, but I don't this argument helps - computer
> languages and human languages are two fairly distinct classes, with
> different origins, requirements, and, um...parsers.
>
> In my opinion they aren't always comparable.


I may have ben too sutle Maybe your email program spel-chex I
certainly didnt have useles double leters in my original

 
Reply With Quote
 
 
 
 
Gregory Brown
Guest
Posts: n/a
 
      05-20-2009
On Tue, May 19, 2009 at 5:40 PM, J Haas <> wrote:

> Well, I think that's probably enough for my first post. Thank you for
> your
> time, and Matz, thanks for the language. Thoughts, anyone?


Implement it, post it on github, then post back here and see if people
like it. These conversations in which people pretend to try to
convince one another just to assert their views are much less
productive than just solving whatever the original problem is.

-greg

 
Reply With Quote
 
 
 
 
Benjamin Kudria
Guest
Posts: n/a
 
      05-20-2009
On Tue, May 19, 2009 at 20:11, Eric Hodel <> wrote:
> I may have ben too sutle =C2=A0Maybe your email program spel-chex =C2=A0I=

certainly
> didnt have useles double leters in my original


Doh

I have a compulsive habit of correcting (perceived!) typos in quotes.
I should probably stop.

Ben
--=20
http://ben.kudria.net | Jabber:

 
Reply With Quote
 
Brian Candler
Guest
Posts: n/a
 
      05-20-2009
J Haas wrote:
> I'm a bit of a Ruby Nuby

...
> I have a proposal


Funny how suggestions for radical changes mainly come from people who,
by their own admission, have not used Ruby seriously in its current
form. But I certainly don't hold this against anyone, because I was the
same myself at first.

Space-delimited syntax has its place: it works well for HAML, which I
love. But I'd hate it for Ruby. I want to be able to disable blocks of
code by wrapping them with

if false
...
end

and generally throw code around without having to re-indent it (even
though I *do* normally stick strongly to standard indentation). In
practice, it's much less frequent that I comment out a block of HAML,
say.

There's one case where the current behaviour *does* trip me up, and
that's in DSLs. For example:

context "a test" do <<<
setup do <<<
@foo = Foo.new
end
should "be empty" do <<<
assert @foo.empty?
end
end

Miss one of the magic 'do's and you get an error later (perhaps much,
much later, say at the end of the file). These can be hard to find;
sometimes I resort to a binary chop. However if I happen to have ruby1.9
lying around I can run it through that, and it gives me warnings about
where indentation is not as expected.

But even then, this does not bug me as much as having Python syntax
would.

Of course, syntax in itself adds nothing to the functionality of the
language, but people have extremely strong preferences. LISP programmers
are strongly wedded to its syntax; Python programmers are strongly
wedded to its syntax too. So if you like Python syntax (and that's more
important to you than other language features), then program in Python.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Juan Zanos
Guest
Posts: n/a
 
      05-20-2009

On May 19, 2009, at 5:40 PM, J Haas wrote:
> My friends, when ONE OUT OF EVERY SIX of your code lines consists of
> just the word "end", you have a problem with conciseness. I


Yes, it's a problem. There is no point in pretending otherwise. The
language
would be even better if this issue were solved. It sounds like it
could be
adequately solved with some type of meaningful indentation.

It doesn't seem like it has to be one way or another. You could have
meaningful indentation and still use end for ambiguous cases. That
would be
nice. This would also be consistent with Ruby's optional parens for
function
use and declaration. Backward compatibility would also make it
possible to
make the transition.

 
Reply With Quote
 
J Haas
Guest
Posts: n/a
 
      05-20-2009
On May 19, 4:49*pm, Eric Hodel <drbr...@segment7.net> wrote:
> Does anybody complain about terminating '}' in C, C++ or Java?


I do, now. Redundancy irritates me.

>*Does anybody complain about terminating '.' on sentences?


If the period accounted for one-sixth of English text, perhaps they
would.
 
Reply With Quote
 
J Haas
Guest
Posts: n/a
 
      05-20-2009
On May 19, 5:19*pm, Gregory Brown <gregory.t.br...@gmail.com> wrote:
> Implement it, post it on github, then post back here and see if people
> like it. * These conversations in which people pretend to try to
> convince one another just to assert their views are much less
> productive than just solving whatever the original problem is.


Ugh, pass. I've wasted far too much of my life coding what I thought
were useful features for open-source projects only to find that the
committers didn't share my opinion. I ain't touching something like
this unless there's at least some reasonable chance the patch might
actually get accepted.

If you want to try this out, as I said earlier in this thread,
preprocessors exist. And seem to work, which kind of belies the claim
that this change would be impossible.
 
Reply With Quote
 
Charles Johnson
Guest
Posts: n/a
 
      05-20-2009
On May 20, 2009, at 10:10 AM, J Haas wrote:

> Ugh, pass. I've wasted far too much of my life coding what I thought
> were useful features for open-source projects only to find that the
> committers didn't share my opinion. I ain't touching something like
> this unless there's at least some reasonable chance the patch might
> actually get accepted.
>

One of the nice advantages of an open source project like ruby is that
you can fork it, and take it in directions not held by the original
developers. Become your own committer. That should be the least of
your worries. If you really do have a better mouse-trap you will have
no problems about finding people who will join *you* rather than the
other way around.

Cheers--

Charles
---
Charles Johnson
Advanced Computing Center for Research and Education
Vanderbilt University


 
Reply With Quote
 
Rick DeNatale
Guest
Posts: n/a
 
      05-20-2009
On Wed, May 20, 2009 at 11:05 AM, J Haas <> wrote:
> On May 19, 4:49=A0pm, Eric Hodel <drbr...@segment7.net> wrote:
>> Does anybody complain about terminating '}' in C, C++ or Java?

>
> I do, now. Redundancy irritates me.
>
>>=A0Does anybody complain about terminating '.' on sentences?

>
> If the period accounted for one-sixth of English text, perhaps they
> would.


wellwhydontwegetridofallpunctuationthingslikespace scommassemicolonsquoteset=
cperiodcertainlytakeupmuchmoreofourprosethantheyde serveandcapitalizationeat=
supvaluableverticalspaceandnoneedforparagraphsepar ationeither

Seriously, if you measure things by avoiding extra keystrokes, get a
better editor. I value readability over parsimony of lexical items.



--=20
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/pers...-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

 
Reply With Quote
 
Michael Bruschkewitz
Guest
Posts: n/a
 
      05-20-2009

"J Haas" <> schrieb im Newsbeitrag
news:abacc69e-f80e-4ef0-a07f-...
...."pythonic insertion"...

I have some suspicion this was a joke thread.
(Hint: Format of OP)
However.
I don't want to discuss this issue because people using non-existing
whitespaces for serious coding probably have a value system which is
orthogonal to my value system.
This sort of structuring pieces of code stopped me from trying Python
seriously.
However.

Isn't there an Syntax-Highlighting Editor out there which allows assigning
1-Point size to End-Only-Lines?
Or, why not just use white-on-white for "end"-statement?
(Maybe you additionally should use CTRL-BS as macro for "end"...)

Wouldnt this be the easiest way to solve your problem?

Regards,
Michael B.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Beating my head -- JSPs and encoding Hegemony Cricket Java 1 08-22-2012 01:29 PM
remove overall indentation preserving reletive indentation Jesse B. Ruby 2 03-27-2010 07:23 PM
Object Oriented vs Pythonic Code, and Pythonic standards Carl J. Van Arsdall Python 4 02-07-2006 10:15 PM
Learning and beating my head Brian Andrus Java 2 05-04-2004 07:38 AM
anyone using an iPod probably deserves a beating Lucas Tam Digital Photography 38 04-29-2004 02:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57