« Names of encodings built in to Ruby 1.9 | Main | Clearly I've missed an opportunity with our book covers »

December 17, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451c41c69e20105367a9947970b

Listed below are links to weblogs that reference Ruby 1.9 can check your indentation:

Comments

poelzi

so, if they strip the useless end out of the syntax it's like python ;)

no-python

@poelzi no way, python is awful... but it's ok pythonists are so lame

Dave Thomas

OK, both of you. Play nice.

Anko Painting

That is a totally killer feature! It was only the other day when I was having trouble with this exact thing! awesome!

Harold

That's useful. Any reason why -w isn't the default behavior?

Daniel Cavanagh

because warnings may or may not be an actual problem, and we shouldn't be scaring people (most importantly users) by default with warnings that aren't actually problems

mark

I used to think the python feature of omitting end is good, but what is it with python's need to use "def foobar():" the : thing? That seemed very redundant. I am still thinking about a language that allows end, and allows to omit ends, but without introducing stuff like :

Anyway, good to know about ruby 1.9 !

Alan

Very useful. Helps prevent the eyestrain caused by searching for that elusive missing end!

Harold

@Daniel,

I understand and agree with you. Guess the real question is, why is this considered a warning? The script can't go on if there's a missing end, so it is in fact an error and not just a warning. Instead of displaying the current default, why not be more specific about what's going on, without having to specify "show me warnings"?

Daniel Cavanagh

well, if you did this instead (one extra end at the end):

class Example
def meth1
if Time.now.hours > 12
puts "Afternoon"
end
def meth2
# ...
end
end
end

then the code is now valid but the warnings would still be printed. some people are sloppy with their whitespace, and they are allowed to be, so the warning can't be shown by default

allen

This is killer. I've waited years for useful error messages from a compiler or interpreter.

Matthew Borgeson

That is trult a great thing..kinda like a Training Wheels for syntax... :-) Being a hobbyist, that little feature would save me so much time...now to make the jump...I just am too comfortable with 1.8.6

Erik J

Very cool. Any chance this behavior will be, or is, incorporated into 'ruby -c t.rb'?

Adobe Business Catalyst

im new to ruby programming, this post is very useful. thanks!

Janne Huttunen

Also one other reason can cause this kind of error messages: unsupported character set of the file! I used to have UTF-8 encoding in my users_controller.rb file, and I used several hours of time to find reason for that....

kevin

I have recently just been learning ruby and the rails frame work. I was making myself nuts trying to find my error, especially since it was a book example I was working on. Thanks for sharing this.

Leander Conradie

Thanks, you can now officially marry my daughter.

Vladiim

That tip is just... magic. Many thanks Dave

The comments to this entry are closed.

Now in Beta

  • Programming Ruby, 3rd Edition
    Third Edition, Covering Ruby 1.9, now available
My Photo

Pragmatic Stuff

Photos

  • www.flickr.com
    This is a Flickr badge showing public photos from pragdave tagged with pragdave_badge. Make your own badge here.