back to article Next; tech; meltdown..? Mandatory; semicolons; in; JavaScript; mulled;

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 …

  1. andy 28

    pascal

    Ah, Borland, come back;

    happy days;

    1. Voland's right hand Silver badge

      Re: pascal

      Took the words out of my mouth.

      Made feel so young and forget about my beard being 50% white nowdays.

      Now, back to carefully tabulating everything to the correct tab mark (or actually having VIM do it for me).

    2. Marco van de Voort

      Re: pascal

      Depends. Does it have semicolon's as statement separator (a la Pascal) or as statement terminator (a la C?)

      IOW is a semicolon before a non statement line (like a closing } ) required?

  2. Dan 55 Silver badge

    "And it, feels, well, a little hurtful."

    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.

    1. teknopaul

      Re: "And it, feels, well, a little hurtful."

      Technically its not ambiguous, asi has rules. As with truthy and falsey, it may be wierd to look at but there are strict rules.

      If you jshint your code it usually looks decent

  3. ijustwantaneasylife

    Alternatively...

    How about something like...

    "use strict2";

    ... to force the requirement?

    1. Anonymous Coward
      Anonymous Coward

      Re: Alternatively...

      Or just use eslint.

    2. elDog

      Re: Alternatively...

      Do you need the trailing semi;?

      1. Anonymous Coward
        Anonymous Coward

        Re: Alternatively...

        "Do you need the trailing semi;?"

        Not until you use strict2 you don't ;-)

      2. el_oscuro

        Re: Alternatively...

        You also forgot the trailing; --

        1. sabroni Silver badge

          Re: Alternatively...

          Use an IDE that puts them in for you?

  4. caffeine addict

    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.

    1. Anonymous Coward
      Anonymous Coward

      Tabs v spaces

      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.

      1. Guus Leeuw

        Re: Tabs v spaces

        Dear Sir,

        languages that need whitespace to decide the structure of a program should be similarly taken around the back of the shed.

        Regards,

        Guus

        1. big_D Silver badge

          Re: Tabs v spaces

          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?

          1. Alistair
            Windows

            Re: Tabs v spaces

            @BigD:

            Please stop reminding me about this nightmare I lived in my youth!

        2. Prst. V.Jeltz Silver badge

          Re: Tabs v spaces

          "languages that need whitespace to decide the structure of a program ..."

          BOO!

        3. Wulfhaven

          Re: Tabs v spaces

          That would be most of them then? Depending on the definition of "structure of a program". I took it to mean "whitespace is significant in source code".

        4. Julz

          Re: Tabs v spaces

          @Guus Leeuw

          Can't up vote you enough...

        5. JLV

          Re: Tabs v spaces

          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.

          1. el_oscuro

            Re: Tabs v spaces

            Don't get me started excessive use of parentheses. Whoever came up with Oracle's tnsnames format should be shot.

          2. eldakka

            Re: Tabs v spaces

            > If you don't, then don't use them.

            Unfortunately, if you wish to work as part of a team on a project (like, say from your employer) then you often don't have a choice on the language being used.

        6. Doctor Syntax Silver badge

          Re: Tabs v spaces

          "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.

          1. Anonymous Coward
            Anonymous Coward

            Re: Tabs v spaces

            > "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.

        7. EarthDog

          Re: Tabs v spaces

          And before some one screams FORTRAN has spaces, F90 took spaces out behind the shed and shot them.

          1. Mike Pellatt

            Re: Tabs v spaces

            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.

          2. Anonymous Coward
            Anonymous Coward

            Re: Tabs v spaces

            "And before some one screams FORTRAN has spaces, F90 took spaces out behind the shed and shot them."

            FORTRAN IV didn't need spaces either. Just respect the card columns.

            FORTRAN USER

        8. Hans 1

          Re: Tabs v spaces

          @Guus

          Python is actually doing quite well and, obligatory Slurp reference, OfficeML was quite popular as well (XML, a whitespace character between tags crashed Word).

        9. Anonymous Coward
          Anonymous Coward

          Re: Tabs v spaces

          "languages that need whitespace or __Semicolons__ to decide the structure of a program should be similarly taken around the back of the shed."

          Fixed that for you.

          Regards, FORTRAN USER

        10. Charlie Clark Silver badge
          Facepalm

          Re: Tabs v spaces

          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.

      2. Robin Bradshaw
        Trollface

        Re: Tabs v spaces

        "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

        1. Simon Harris

          Re: Tabs v spaces

          Talking of things that should be taken out to the back of the shed...

          applications made by "copying and pasting a mish mash of stackoverflow answers"

          1. Matthew Taylor

            Re: Tabs v spaces

            >applications made by "copying and pasting a mish mash of stackoverflow answers"

            An IDE centered around gluing code fragments from stackoverflow and github together, would surely be the next big thing.

            1. Anonymous Coward
              Holmes

              Re: Tabs v spaces

              You could fix this. Anyone want to go halfs with me on the millions we could make designing an easy fix for both Tab and Space lovers with one stone?

              (Obvious, if it's white space confusing things... get rid of it!)

          2. Temmokan

            Re: Tabs v spaces

            That would exterminate 90% of code. Don't suggest such terrible ideas.

        2. Anonymous Coward
          Anonymous Coward

          Re: Tabs v spaces

          > it saves loads of aggro when copying and pasting a mish mash of stackoverflow answers

          Ah, programming by Stackoverflow. What could *possibly* go wrong?

      3. Anonymous Coward
        Anonymous Coward

        Re: Tabs v spaces

        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.

      4. nijam Silver badge

        Re: Tabs v spaces

        > Can be a real pain with Python ...

        That's what you get for using a language where white space carries a semantic content. It really is a misguided design.

        1. handleoclast
          Coat

          Re: Tabs v spaces

          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!

      5. Anonymous Coward
        Anonymous Coward

        Re: Tabs v spaces

        "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.)

        1. Charlie Clark Silver badge

          Re: Tabs v spaces

          Not if you use a decent editor, it doesn't (I prefer emacs - your own tastes will vary)

          You can also hit problems when working with people who different settings in which case a per-project convention is necessary and in general this will follow PEP 8 and use spaces.

      6. Ken Hagan Gold badge

        Re: Tabs v spaces

        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.

        1. mearnsgeek

          Re: Tabs v spaces

          > A computer should never guess

          > what the programmer meant.

          As someone who developed a web browser in the early 2000s, this comment is spot on.

          It really means that your programming language should not have sloppy grammar - get this semicolons in there and quit whining.

    2. TotallyInfo

      Perhaps because JavaScript is used by LOTs of people who are not professional developers and to whom constant clutter is a distraction that makes it harder to write logic.

  5. Lysenko

    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.

    1. caffeine addict

      I was starting to think I was the only one who remembered that it used to stand for Personal Home Page...

    2. Anonymous Coward
      Anonymous Coward

      Awww diddums!

      Agreed, if he just writes code in JS he's not a "real" programmer - I bet he eats Quiche!

    3. Fred M

      "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."

      Exactly. And if you don't agree then you should go help your uncle jack off a horse.

    4. Jove Bronze badge

      The snowflake has clearly not been subject to a thorough code review at any time; that just about says it for Javascript development as a whole.

  6. Anonymous Coward
    Anonymous Coward

    ...programmers, aware that every additional character offers another chance to make an error...

    Huh? I'd bet good programmers don't mind adding more characters if that lead to clarity.

    1. SVV

      Re: ...programmers, aware that every additional character offers another chance to make an error...

      Yes Someone who finds clarity in code important is invariably also a good programmer (becsause it shows thought and understanding of the craft)

      This is really a debate between compiled and interpreted code - and I MUCH prefer the former as you have to follow the rules 100% to even compile successfully. My experience with Javascript and its' "this may or may not work or it also may not work in the way you thought it would" character led me to avoid taking on any job that even hinted that I might have to use it again after my one hateful experience with it.

      1. Androgynous Cupboard Silver badge

        Re: ...programmers, aware that every additional character offers another chance to make an error...

        Personally I leave all the brackets out of my equations, as by this metric it makes them more likely to be correct.

        1. elDog

          Re: ...programmers, aware that every additional character offers another chance to make an error...

          OMG, another FORTH programmer! On El Reg!

          Nothing but words and pages.

          Of course, the dream language of special characters that mean a lot is APL.

          1. Mike Pellatt

            Re: ...programmers, aware that every additional character offers another chance to make an error...

            Of course, the dream language of special characters that mean a lot is APL.

            Yabut... invert a matrix with a single operator. That's class. (Not touched the language since 1974. Still remember that. Awesome.)

          2. TotallyInfo

            Re: ...programmers, aware that every additional character offers another chance to make an error...

            Now you are talking. Both of those are in my past!

            FORTH: great for squeezing the entire operations of an airport into something no bigger than a raspberry pi! But really head-twisting to get the reverse-polish notation right :)

            APL: Spending a week puzzling over a single line of code that recalculated the universe - magic! Of course, useless if you ever wanted to go back and change it 6 months later! Loved it nonetheless, made me feel like I was a mathematician :)

  7. Tom 7

    Bad programmers blame the syntax.

    Its a bit like colour or fonts - the computer doesnt really give a shit and yet I've had half my life wasted in meetings while tossers argue about what colour and font 'means'. Just follow the project/company guidelines - or in the case of things like font or colour move everything that depends on it to the design department (that's what CSS is for ffs) so the anally retentive can worry about it while you get on with the code.

    Don't argue with wanky style guides - argue with the computer. At least there's some logic there to get your teeth into and you have a chance of winning.

    And if you are so old you cant adopt your coding style you should at least be able to write the code that will convert your coding style into whatever is required.

    1. Doctor Syntax Silver badge

      Re: Bad programmers blame the syntax.

      "And if you are so old you cant adopt your coding style"

      Ah, poor little orphan coding style, looking for new parents.

    2. Paul Hovnanian Silver badge

      Re: Bad programmers blame the syntax.

      Oh boy! This brings back memories.

      Back when I was working on some automated knowledge capture, we ran into Microsoft products. Engineers who had written documents originally intended for human consumption had created tabular data by adjusting cell entries with a suitable number of tabs and spaces. And then to make larger entries fit their column, scrunch the font down for that one cell. OLE had barely been invented and most engineers couldn't be bothered to embed a spreadsheet object into a text document. And since there were no strict style guidelines (other than make it look nice for the boss), everyone had their own solution.

      We eventually did fix the problem with some heuristics that could recognize things that looked like tables, calculate column widths based on font selection (among other things) and make a pretty good guess as to what was going on. The final solution was to import the parsed content into SGML and dump the author into the appropriate editing environment with structure and rules for the next data set version release.

    3. eldakka

      Re: Bad programmers blame the syntax.

      > And if you are so old you cant adopt your coding style you should at least be able to write the code that will convert your coding style into whatever is required.

      Sorta agree - I say sorta because you don't need to write your own...

      There are plenty of "pretty print" programs out there that already do this. And they work much better when you have a structured language that requires braces and semi-colons and so on, much easier to parse for pretty printing.

  8. Pen-y-gors

    Memory time...

    I have no problem with semi-colons;

    I tend to put them in anyway just to be safe;

    I'm also a fan of BEGIN/END or {} blocks, even when not strictly necessary, because {

    They make it clear exactly what the scope of a statement is;

    }

    I learned coding 40+ years ago, on Algol W - that used semi-colons. Since then a fair proportion of the languages I've used (PL/1, Javascript, Java, PHP, Perl etc) have used semi-colons, so they tend to come as naturally as breathing;

    I do agree though that it should remain a warning, or a lot of code will break;

    1. Brewster's Angle Grinder Silver badge

      Re: Memory time...

      El Reg slightly mangles this. (Imagine the + term was indented and there was a single line break)

      return someObject.someMethodCall()

      + someOtherObject.otherResultRequired();

      You know when you've been fucked by ASI.

      Yes, there are myriad ways to fix this. The point is those of us who are adults still have to worry about ASI.

    2. nijam Silver badge

      Re: Memory time...

      > ... or a lot of code will break

      you mean "a lot of code will be revealed to have been broken for years", surely?

    3. druck Silver badge
      Flame

      Re: Memory time...

      No!

      {

      block;

      }

    4. elDog

      Re: Memory time...

      I think it should be a FATAL: "Do not use languages that permit ambiguity".

      All decent Perl programmers turn on warnings and fatals. It's not just to catch programmers fat-fingering a wrong sequence but also to catch machine and data-dependent errors.

    5. eldakka

      Re: Memory time...

      > I do agree though that it should remain a warning, or a lot of code will break;

      From the context, they want to enforce strict semi-colon usage because ASI has issues with newer 'advanced' features that have complex requirements.

      I imagine it would be pretty easy to have a detection routine that says "you aren't using any of the newer version X features, therefore I won't enforce strict semi-colon requirement". Therefore any code written before fancy feature X is defined won't have fancy feature X - because it doesn't exist - and can be detected as not needing strict. And any new code written after fancy feature X is introduced, but doesn't use fancy feature X, can also be detected as not needing it.

      Therefore it should only enforce strict semi-colon if those features are detected.

  9. Prosthetic Conscience
    Trollface

    "but it sounds like the TC39 is saying we're bad for using the language in a particular way"

    He should switch to Perl

    1. Pen-y-gors

      Re: "but it sounds like the TC39 is saying we're bad for using the language in a particular way"

      If there's someone you dislike, by all means wish that they catch a painful, slow and terminal disease or fall into something with lots of sharp blades, but NEVER wish that they switch to Perl!

  10. Anonymous Coward
    Anonymous Coward

    Anyone seen a single line C program ?

    Guy I used to work with - contractor. He worked on code normally, but ran it through a macro to strip out whitespace.

    Compiled perfectly, but couldn't be worked on without the unadulterated source.

    I imagine contracts are tighter now, so that legible source is mandated, but back then it wasn't. Eventually they had to pay a pretty sum to get the clean source so others could work on it.

    1. Pen-y-gors

      Re: Anyone seen a single line C program ?

      APL couldn't be worked on even WITH the unadulterated source.

      1. Alistair
        Windows

        Re: Anyone seen a single line C program ?

        @ Pen-y-gors....

        I have 300 page manual of APL somewhere. One of my exes mistook it for a book of mandalas.

      2. Doctor Syntax Silver badge

        Re: Anyone seen a single line C program ?

        "APL couldn't be worked on even WITH the unadulterated source."

        APL and "unadulterated source" both in one sentence. Who'da thunk it?

    2. Lysenko

      Re: Anyone seen a single line C program ?

      That was common with xBase libraries and it's ubiquitous with JavaScript (uglfiy.js etc) because compressing out whitespace and converting variables to single characters reduces the size of downloads (bogus argument of course since you can just gzip the un-obfuscated source and any browser too retarded to support gzip isn't going to support ES5/CSS3 reliably anyway).

      The key to success with JavaScript and it's tooling is realising that when you think:

      "I'm missing something. It can't be this retarded. Turbo C/Visual Basic/Delphi was more advanced 20 years ago!?"

      ... you're wrong. It really is that retarded and the browser programming model really is Win16 redux, complete with message queues, async API callbacks, state machines a-go-go and no threading worth a damn. With ES8/TypeScript and web workers (threads) the JS eco-system might catch up to Delphi 3 on WinNT 4 by 2025 - maybe - but don't count on it.

      [*] I've just spent 3 months writing an Angular 4 system so I'm not just ranting from the sidelines.

      1. Androgynous Cupboard Silver badge

        Re: Anyone seen a single line C program ?

        Actually, after 20 years of Java threading I'm coming around to the JavaScript everything-is-a-callback idea. Yes it's a bit clunky at times, but clunky is better than looks-correct-but-isn't, which is what normally happens with threads at some point. There's a lot to be said for a purely event-driven model.

        1. Lysenko

          Re: Anyone seen a single line C program ?

          Actually, after 20 years of Java threading I'm coming around to the JavaScript everything-is-a-callback idea.

          After 20 years of Java threading[1] one appreciates why GoRoutines were invented (or Erlang).

          [1] Not that I've ever used Java in anger, but you can lose yourself in semaphore/mutex hell with C++ as well, which what I'm assuming you're referring to. Node/JS is equivalent to tackling flu by mandating mouth breathing and abolishing noses - you can always eat dinner with a callback after all.

        2. Anonymous Coward
          Anonymous Coward

          Re: Anyone seen a single line C program ?

          > Actually, after 20 years of Java threading I'm coming around to the JavaScript everything-is-a-callback idea.

          New code no longer uses callbacks, by and large. It would be promises or async / await (which are promises in a different guise).

          P.S.

          Word of advice: stop reading Stackoverflow. It is full of obsolete "advice", much of it non-quality-controlled copy and paste from a regular web search by people who are into gamification (they get "rewards" of no physical value, such as additional icons next to their name) and have better google skills than you and more time in their hands. On top of that, Google's algorithms seem to weight the site heavily so that copy/paste gets amplified. Remember that Google relies on popularity, not necessarily correctness.

          1. Jonathan 27

            Re: Anyone seen a single line C program ?

            Promises are just a better way to use callbacks. It's all syntactic sugar.

      2. Anonymous Coward
        Anonymous Coward

        Re: Anyone seen a single line C program ?

        > it's ubiquitous with JavaScript (uglfiy.js etc) because compressing out whitespace and converting variables to single characters reduces the size of downloads (bogus argument of course since you can just gzip the un-obfuscated source and any browser too retarded to support gzip isn't going to support ES5/CSS3 reliably anyway).

        It was not entirely a bogus argument before HTTP/2, because it also reduced the number of requests, which is where the speed improvements mainly came from.

        Nowadays, with gzip encoding and HTTP/2, I am not sure there is much client-side value in packaging assets like that, although there are still some caching improvements and it makes life slightly easier in terms of the build chain (pull with npm, then use browserify or the like to put in the right place, etc.).

    3. Christian Berger

      Re: Anyone seen a single line C program ?

      That's actually something companies do in the car industry. They have to give out the code for contract reasons, but then they uglify it before sending it out for insanity reasons.

      1. el_oscuro

        Re: Anyone seen a single line C program ?

        I actually wrote a 1 line C program. And that code is still running in production.

        I had a simple requirement: Run a shell script at a regular interval like every 15 minutes, and log the stdout/stderr to a log file. In Unix I would just put it in the crontab and be done with it. But I had Windows NT 4. The original AT scheduler was very limited but at least it worked. The installation of IE6 completely replaced it with a GUI which I could never get to work. And we couldn't use it as we didn't have RDP anyway.

        So my program was basically:

        int main(int argc,char *argv[])

        {

        system(argv[1]);

        }

        Why would I need this? We couldn't use cygwin or something like that for cron scheduling but we did have the Windows NT resource kit which included the SRVANY utility. This utility allows a command to be run as a service. But that command has to be an EXE and not a .BAT file. I also tried CMD /C but that didn't work either.

        The scripts themselves handled all of the scheduling and logging, similar to Unix cron scripts that configure the environment.

        10 years ago, we were 100% Windows and these scripts ran *everywhere*. Now we have migrated much to Linux but there are still production applications that use this 1 line program.

    4. David Nash Silver badge

      Re: Anyone seen a single line C program ?

      Why would you even do that? Was he desperate for that client never to offer him a contract again?

    5. Ken Hagan Gold badge

      Re: Anyone seen a single line C program ?

      This must have been a *long* time ago. UNIX has had "indent" for about 40 years and Visual Thing has had something close enough for over 20.

    6. Tom 7

      Re: Anyone seen a single line C program ?

      Proper C programmers use this as a style guide: https://www.ioccc.org/

      If you look hard enough there is code that looks exactly like the output it produces - this has to be the ultimate commenting!

    7. Anonymous Coward
      Anonymous Coward

      Re: Anyone seen a single line C program ?

      > Guy I used to work with - contractor. He worked on code normally, but ran it through a macro to strip out whitespace.

      What an imbecile.

      > Eventually they had to pay a pretty sum to get the clean source so others could work on it.

      That would have been the last cheque he got from his employer too. Not to mention that word gets around quickly.

      1. Jonathan 27

        Re: Anyone seen a single line C program ?

        If I was his supervisor I would have bitched him out on the first comment-less and whitespace-less commit and if he continued cancelled his contract for poor code quality. If you're a contractor, everything you produce belongs to the company, they're paying you for your time, not whatever you feel like giving them.

        1. Anonymous Coward
          Anonymous Coward

          Re: If I was his supervisor

          Yes, well, the problem is few workplaces are perfect - as you well know.

          This is the same company (now defunct) that hired an Oracle SQL guru to rewrite T-SQL stored procs. Was there 6 months. Fucked off. We loaded his "code" up and discovered that he'd done **** all for 6 months. Cue my having to crash-learn Oracle SQL to get it working for the client.

          Hindsight is a wonderful thing.

          At a previous employer, there was a contractor who was the only resource that could work with SCO-Unix. They couldn't sack him, and he repeated declined suggestions that he become an employee.

  11. Jove Bronze badge

    "This makes me a little sad. JS is the only language I write, and I don't use semicolons. I know it's just a warning clause, but it sounds like the TC39 is saying we're bad for using the language in a particular way. And it, feels, well, a little hurtful."

    Poor kid; don't you just feel for it.

  12. spold Silver badge

    What's old is new again

    Algol 60;

    1. Anonymous Coward
      Anonymous Coward

      Re: What's old is new again

      I'm sure I've encountered a langauge which use double-semicolons as statement terminators but can't remember what it was

      1. sweh

        Re: What's old is new again

        "I'm sure I've encountered a langauge which use double-semicolons as statement terminators but can't remember what it was"

        shell script "case" statements use ";;" to end the case

        eg

        case $a in

        x) foo ; bar ;;

        y) baz ;;

        *) echo Ooops ;;

        esac

    2. elDog

      Re: What's old is new again

      And JOVIAL (Jules Own Version of the International Algorithmic Language).

      I actually had to code in it for a short while since Ada hadn't been fully specified for the intended satellite use.

      Again, a call-out to FORTH and PROLOG!

  13. sawatts

    Always prefer a language to require the developer to be explicit rather than having to guess their intent.

    However if you think tabs vs spaces don't matter you've not had to maintain a lot of makefiles.

    Meanwhile recall the proposal to provide whitespace operator overloading in C++?

    [http://www.stroustrup.com/whitespace98.pdf]

    Although the worse example I recall being told about was a proposed language for minicomputers which used normal, italic, bold as part of the language syntax. ...until it was pointed out that in some situations you'd have to be able to tell the difference between a normal and italic full stop.

    1. Simon Harris

      "a proposed language for minicomputers which used normal, italic, bold as part of the language syntax"

      How about this one then...

      https://en.wikipedia.org/wiki/Whitespace_(programming_language) ?

  14. Christian Berger

    Why stop there?

    I mean if there's a component in Javascript compilers adding semicolons, why stop there? Why don't we standartise it to also add random +4 or similar things to the code, if a semicolon is missing.

  15. Simon Harris

    Optional syntax characters.

    I'm using this as a precedent to considering decimal points optional next time I make an expenses claim.

  16. AndrueC Silver badge

    That didn't work with SQL programmers. What makes them think that JavaScript programmers are more likely to adhere to such a rule?

  17. PiltdownMan
    Facepalm

    What about FULL-STOPS

    I remember writing a very small COBOL program (back in the Jurassic period, I think it was) of around 100 lines. I missed ONE full-stop out, leading to 400+ error messages!!!

    I inserted the offending missed full-stop ( by replacing the erroneous 80 column punched card ) and all the errors disappeared.

    Nice!!

    1. Throatwarbler Mangrove Silver badge
      Thumb Up

      Re: What about FULL-STOPS

      Username checks out.

  18. Jonathan 27

    Yeah...

    "What's more, this laissez-faire approach makes JavaScript fairly forgiving, which in turn makes it more appealing to inexperienced programmers."

    And also a terrible choice for inexperienced programmers, a language with strict typing is much easier to debug and therefore a better choice for inexperienced programmers.

    As for semi-colons, I always put a semi-colon on the end of every line in JavaScript. You can really kill yourself looking through code forever just to find an error caused by a missing semi-colon. Making them a language requirement will prevent a few errors, but it will also not be backwards compatible. Is the small benefit worth the small risk for existing code bases? I'd say it's defendant on what your existing code looks like. For mine, it looks just fine.

  19. Mike Pellatt

    ObColonsInProgramsReference (OK, it's not semicolons. But it still makes me giggle. And so true).

  20. DrXym

    Code formatters often remove them

    I write semicolons out of force of habit since most C-like languages require them. But when I run a code formatter, one of the rules will normally strip out the unnecessary ones.

    Personally though I think this is symptomatic of the dog's dinner that is Java / ECMAscript. Poorly thought out legacy behaviour that keeps biting people on the ass even to this day. See also the difference between null and undefined - if null was a billion dollar mistake I wonder how much of a mistake undefined is. Or the laughable scope rules for var. Or the difference between == and ===. Or the binding (or not) of this. And a million and one stupid other things.

    I'm glad that WebAssembly is a thing now. In time it will provide a choice for web development which doesn't involve writing directly or indirectly (via Typescript / Coffeescript et al) in Javascript. Let Javascript go back to what it was supposed to be in the first place - glue.

    1. Craig100

      Re: Code formatters often remove them

      <rant>Would dearly love to remove the code formatting in Visual Studio 2017. If you're writing web sites (C#, Razor, JS, CSS/SASS) you can't switch it all off. Well, you think you have, but then you try copying and pasting a bit of code, in the same page even, and bang, it's reformatted the damn thing for you. If you're not quick enough with Ctrl+z you end up expending more keystrokes fixing the formatting than writing the code. Needless to say, Microsoft couldn't give a flying f**k about it. I know, I've been on at them for years about it. Couldn't care less. All they want to do is the next whizzy thing no one asked for, not the basics everyone uses.</rant>

  21. Anonymous Coward
    Anonymous Coward

    I actually got bitten by this a few days ago

    I had a long template literal to return from a function and I thought it would look better if I would put the return statement on a line of its own.

    Of course, the function stopped returning any value at all, and because there was no actual code (only values) after the return statement, the interpreter wasn't putting out a warning either.

    But I like JavaScript. It's crazier than R by a mile!

  22. Anonymous Coward
    Anonymous Coward

    This is really easy...

    People are making this way too complicated. It's really this easy, just three simple rules:

    1. Semicolons to terminate statements should be required. Anybody not using them should be fired.

    2. Braces to denote blocks of code, even if just one statement, should be required. Anybody not using them should be fired.

    3. Spaces (NOT TABS) should be required. Anybody using tabs should be fired.

    I have just solved 99% of ECMAScript's issues in three simple rules. Where do I send my consulting invoice?

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Other stories you might like