pascal
Ah, Borland, come back;
happy days;
In what non-technical people might take as an attempt to outdo the absurdity of the tabs vs. spaces debate that continues to divide programmers, the TC39 technical group that advises the development of ECMAScript – the specification from which JavaScript is implemented – has proposed telling web developers to terminate …
It's not about the feels, it's that JavaScript is ambiguous if you rely on ASI. I thought any programmer would have been able to understand that.
It's also ambiguous in a thousand other ways too, but I guess nobody's going to do the decent thing and take it round the back of the woodshed and shoot it, so we'll have make do with minor improvements like this.
Like most programmers, I guess, I have strong opinions on tabs vs spaces, but why the hell is a semicolon an issue? Most languages I've used have insisted on them so I use them habitually and can't see the issue in adding them.
For tabs vs spaces, the only argument I can see for spaces is that online resources use spaces so it makes grabbing snippets easier. Tabs lets the developer choose how big an indent they want, and (potentially) lets every developer have their own preference without messing up other people's code. But, honestly, most IDEs nowadays let you toggle back and forth easily enough that I'm not sure why anyone cares.
Can be a real pain with Python where the number of characters forming the indent specify the block level.
Does that line have an indent of '1' or four?
Unambiguous if a space is used, but it may appear as multiple spaces if tabs are used - e.g. two in one editor and four in another. Gets really nasty to work out why the code doesn't work as expected if a mix are used - code may be at different block levels even when it shows as being at the same level.
RPG II anyone? Each position on the first line was another configuration parameter and woe betide you if you missed a character.
Then setting flags, using exact column positions.
Give me semi-colons and tabs/spaces any day!
And what about in-line or hanging opening curly brackets?
So, by that line of reasoning, Lisp should be shot because _I_ think its excessive use of parentheses sucks? Despite being a super clever language with devoted followers?
Hint: in both cases, their formatting approach is a meta design-feature. Plenty of people like that design, plenty do not.
If you don't, then don't use them.
Thankfully languages are not like Maduro in Venezuela, plenty of choices around.
Heck, I've even heard from reliable sources that some people like PERL.
"languages that need whitespace to decide the structure of a program should be similarly taken around the back of the shed."
I can see why someone thought it would be a good idea. I can also see why it isn't. An IDE that automates indentation or something like cb is a better solution.
> "I can see why someone thought it would be a good idea."
Me too. Some programmers obsessively indent their code to keep it visually clear. They have also noted how the curly braces or parentheses can be logically implied by their ever-present indentation. It is therefore natural that they should take the next step and remove those maddening braces! Thus were born the indent-aware languages.
Python is liked by those who also like to indent anyway. This is good because such people tend to be strong performers, and having a language they are comfortable with cannot be a Bad Thing. No one is forced to use Python (well, hardly ever) and the rest of us are happy with our sloppy braces.
Yeah, well, that was because no-one uses punch cards any more.
Really, once they went the way of the dodo, the Proper Thing to do was absolutely to treat any amount of contiguous whitespace equally. I have that etched into my brain thanks to 'C', which is probably one of the reasons I grapple with Python.
languages that need whitespace to decide the structure of a program should be similarly taken around the back of the shed.
Because? Block delimiters are required for the compiler whitespace is just as good for this as semicolons are and have the advantage of increasing readability.
"Gets really nasty to work out why the code doesn't work as expected if a mix are used"
Dont you have a just-fixit script to replace all tabs with 4 spaces? it saves loads of aggro when copying and pasting a mish mash of stackoverflow answers, some with tabs and some with spaces. :P
Can be a real pain with Python where the number of characters forming the indent specify the block level.
Only if you're an idiot and mix tabs and spaces (or spaces and more spaces) in indentation.
Does that line have an indent of '1' or four?
"Does that line have an indent of 2, 3, 4, 5, 8 spaces?"
Unambiguous if a space is used, but it may appear as multiple spaces if tabs are used - e.g. two in one editor and four in another.
So someone who reads 8-character indented code more easily could read your code more easily? The horror!
Would you prefer to force all developers to work with the same font and text size? That would make it even more unambiguous!
Gets really nasty to work out why the code doesn't work as expected if a mix are used
And yet you spacers conveniently forget that you have even worse problems if two people both use spaces, but have their preferred "space" indent set to different widths.
Use an editor with visible white-space. Use an editor which auto-adjusts indentation behaviour to the file. BE CONSIDERATE.
By which, I mean: tabs are objectively superior.
That's what you get for using a language where white space carries a semantic content. It really is a misguided design.
Python's semantic whitespace is clearly an inferior imitation of Damian Conway's Acme::Bleach module for perl. From the description: The first time you run a program under use Acme::Bleach, the module removes all the unsightly printable characters from your source file. The code continues to work exactly as it did before, but now it looks like this:
use Acme::Bleach;
Plenty for the tab vs space people to argue over!
"Gets really nasty to work out why the code doesn't work as expected if a mix are used - code may be at different block levels even when it shows as being at the same level."
Not if you use a decent editor, it doesn't (I prefer emacs - your own tastes will vary)
But then what do I know? I've only been a Python dev for 15 years ...
(I'm not saying that it's a particularly _good_ idea, but the people who use it as a stick to beat Python with clearly haven't used it for any length of time. Or have a crap text editor.)
If a mix is used, the whole file is declared syntactically invalid. Problem solved.
A computer should never guess what the programmer meant. Tolerance has its place, and that place is end-user input. Programmers should just get it right and they should have the input thrown back at them repeatedly until they do that.
Funnily enough, this is also the answer to JavaScript's semi-colon question.
Berlin-based developer Yoshua Wuyts laments
Berlin-based hobbyist, I think you mean. I have never met a developer who only used a single language, except for some embedded guys who do everything in C (and even they know several ASM flavours). If all you know is JS then you're equivalent to a VBA power user writing Word macros, which is a useful skill but doesn't give you a credible perspective for addressing language design issues. Listening to guys like this is how Personal Home Page managed to become and remain the worst language in the world (tm).
And it, feels, well, a little hurtful."
Get used to it, snowflake. You're dealing with computers here. They don't "do" empathy and they don't give an Aardvark's left testicle about your emotional state.