On 2009-12-15, David M. [email protected] wrote:
On Monday 14 December 2009 02:55:06 pm Seebs wrote:
On 2009-12-14, David M. [email protected] wrote:
And again, optional significant whitespace. Would you stop using Ruby
if it became an option?I don’t think it makes sense to describe it as optional.
Why not?
If it’s there, then the parser has to handle it for any modules which use
it. Which means I have to deal with at least some incoming code using it,
and that means I can no longer trust blocks to have end markers.
So, by this logic, use (or lack) of parentheses are optional, as are curly
brackets around hash literals (if they’re immediately passed as the last
argument to a method)…
The grammar for parentheses in Ruby is not-optional, but it happens to
allow either form.
Hmm. Here’s the thing. You can’t do it unless you have some special
token that indicates the start of a block which is whitespace-delimited.
Otherwise, consider:
if true
indented
things
more things
end
Did that block end at “more things” or at “end”?
For it to not be ambiguous, you have to know in advance which one you’re
looking for.
Do you really not find ways people can write unreadable code in Ruby as it is?
Oh, sure. But the language is at least theoretically subject to
indentation
fixers now. It wouldn’t be with this change.
I don’t feel it should be the job of the language to enforce coding standards,
and that is one of the reasons I use Ruby in the first place.
I suppose if we’re talking about a special thing which introduces
blocks,
part of my objection goes away – it’s no longer impossible.
I still can’t comprehend wanting that feature – it’s always struck me
as introducing a lot more prospective undiganosible errors than it
could ever remove.
(Disclaimer: I get a lot of mail that’s been corrupted by a messaging
server which strips or squashes leading whitespace.)
-s