News for hackers. Stuff that matters.
Re:John Resig: JavaScript as a First Language by dextorious on Wednesday December 21, 2011 @06:32PM (#3379595)
It's 2011. We love significant whitespace now, get on with the times...
Re:John Resig: JavaScript as a First Language by mindcrime on Wednesday December 21, 2011 @10:21PM (#3380210)
Speak for yourself. I can tolerate Python's whitespace standards, but I - for one - damn sure don't "love" anything about whitespace being significant.
Re:John Resig: JavaScript as a First Language by malandrew on Wednesday December 21, 2011 @07:30PM (#3379766)
Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace.

Getting stuck and being frustrated hurts motivation a lot.

Now curly brackets and syntax may be seen by a person as an irritation or inconvenience compared to whitespace, but I'd say it's better to use a language with an inconvenience than one which is more likely to leave you stuck.

You, I and others used to programming with insignificant whitespace have developed and eye for detail and can rapidly spot a whitespace but. The general population with no programming experience can't consistently space most of the documents in their life, but they can typically place periods correctly.

Re:John Resig: JavaScript as a First Language by zephyrfalcon on Wednesday December 21, 2011 @08:09PM (#3379872)
""" It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace."""

Is it? Assuming you use a fixed-width font, any incorrect/inconsistent indentation should stand out like a sore thumb. More so than counting { }s in nested blocks. (Of course, decent editors help with both cases, so I think it's essentially a non-issue.)

Re:John Resig: JavaScript as a First Language by malandrew on Thursday December 22, 2011 @03:34PM (#3383138)
You've never run into problems with hard spaces vs soft spaces vs tabs?

Visually they look the same, but finding those problems is a pain.

Re:John Resig: JavaScript as a First Language by dextorious on Wednesday December 21, 2011 @07:48PM (#3379817)
"""Assume you've never programmed before. Would you want to debug a program that has a significant whitespace bug? It's much easier for the average person to spot an unbalanced parenthesis that an incorrectly sized whitespace."""

I'd argue that for a beginner it's equally difficult.

And how about this equally difficult to spot classic bug:

if (f==x)

  do_something()

  and_also_do_this() //oops!
a language with significant whitespace does not permit it. It gets people using the correct indentation levels from the start, whay they should have used anyway in any language, even one where whitespace doesn't matter.

I propose we don't talk about languages with "significant whitespace", but instead about "languages with proper indentation enforced".

Re:John Resig: JavaScript as a First Language by melling on Thursday December 22, 2011 @12:45AM (#3380564)
Why is this hard to catch? Format your code and the incorrect indentation goes away. A beginner should be taught to run the formatter to keep the code neat.
Re:John Resig: JavaScript as a First Language by chimeracoder on Wednesday December 21, 2011 @11:45PM (#3380429)
> I propose we don't talk about languages with "significant whitespace", but instead about "languages with proper indentation enforced".

Yes, 'significant whitespace' is too sweeping a term to be useful. I've heard people complain about Python's 'significant whitespace' until they realize that it uses basically the exact same whitespace rules as Java does, except with sensible indentation rules instead of braces.

http://www.secnetix.de/olli/Python/block_indentation.hawk

Re:John Resig: JavaScript as a First Language by malandrew on Thursday December 22, 2011 @03:37PM (#3383151)
What language is that snippet supposed to be in?
Re:John Resig: JavaScript as a First Language by gnaritas on Wednesday December 21, 2011 @07:12PM (#3379720)
No, we don't. Kids who don't know better might think it's cool; it isn't.
Re:John Resig: JavaScript as a First Language by dextorious on Wednesday December 21, 2011 @08:01PM (#3379852)
Yeah. Because only kids use and love Python and like the significant whitespace, right? And Haskell with it's significant whitespace --yeah, that's another language for "kids who don't know better"...

Anyway --you're a Smalltalk guy. How do you get to talk about weird syntax people don't like? Do many people like interleaving-argument selectors?

Re:John Resig: JavaScript as a First Language by gnaritas on Wednesday December 21, 2011 @10:17PM (#3380200)
You're mistaken if you don't think a shit ton of people dislike Python exactly because of significant white space as well as it being the source of a great many bugs.

As for Smalltalk, yes, they do like them, since faking them by passing literal hashes is a common pattern.

Re:John Resig: JavaScript as a First Language by dextorious on Wednesday December 21, 2011 @10:46PM (#3380280)
"""You're mistaken if you don't think a shit ton of people dislike Python exactly because of significant white space"""

Those people don't use Python anyway. There are a shit ton of people disliking anything you can think of. I don't know of many people that tried actually USING Python and still dislike the use of whitespace.

I also don't think the "whitespace haters" are intelligent about it or have any basis. For one, you should follow EXACTLY the same whitespace conventions in any bracketed language, even C. That is: you should properly indent blocks, and you should not mix spaces and tabs. If someone does not do that, I don't really think many people would like to work with his code. And if he already does that, then Python's whitespace is not any different, it just removes the brackets.

"""as well as it being the source of a great many bugs."""

I cannot think of ANY bug that can be caused by Python's use of significant whitespace. On the contrary, it prevents a lot of common bugs in bracketed languages (if/else nesting, etc).

The only think Python's use of whitespace can cause is compiler error messages (when you have messed the indentation) -- which is totally different from "bugs".

So, what bugs are you talking about? Any specific example?

"""As for Smalltalk, yes, they do like them, since faking them by passing literal hashes is a common pattern."""

Literal hashed are more like named arguments than Smalltalk selectors. For one, elements inside them are optional...

Re:John Resig: JavaScript as a First Language by gnaritas on Thursday December 22, 2011 @01:22AM (#3380633)
The issues around significant white space are well known and well blogged about, I'm not going to re-argue them here; google it you must, it's an old argument. If it doesn't bother you, so be it, but you're not going to sell me on it because it's crap; I can't stand Python.

If you don't think it has ever caused bugs, then you aren't thinking very hard or you've not looked into the opposing point of view at all. In any case, I'm done discussing it with you.

Re:John Resig: JavaScript as a First Language by dextorious on Thursday December 22, 2011 @09:15AM (#3381550)
"""If it doesn't bother you, so be it, but you're not going to sell me on it because it's crap; I can't stand Python."""

Yeah, I thought that was your conception on the issue: i.e just blind prejudice.

"""If you don't think it has ever caused bugs, then you aren't thinking very hard or you've not looked into the opposing point of view at all. In any case, I'm done discussing it with you."""

You invoked some mysterious bugs due to Python's whitespace rules, I asked for a specific example, but conveniently "you are done discussing it".

Nice.

Re:John Resig: JavaScript as a First Language by gnaritas on Thursday December 22, 2011 @10:17AM (#3381746)
I told you to google it because it's common, don't be an ass. Obviously I'm talking about the difficulty of sharing code and cut and paste issues between developers who have different ideas about tabs vs spaces.

It's not blind prejudice, signifigant white space is a valid reason to dislike a language; that's anything but blind. That is but one of several reasons I don't like Python, and none of them are blind. Ruby is my scripting language of choice when Bash isn't sufficient.