Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming

Douglas Crockford Envisions A Post-JavaScript World (infoworld.com) 300

JavaScript developer (and JSON proponent) Douglas Crockford recently described "a theoretical post-JavaScript World," according to InfoWorld. Crockford "believes the web development staple needs a successor that can fix multiple programming nuances." An anonymous reader summarizes their report: Despite its status as the world's most popular language, Crockford told an audience at the Oracle Code conference, "It would be sad if JavaScript turns out to be the last language." He complained that JavaScript has two different ways of declaring variables -- let and var -- as well as two different "bottom variables" with no value -- both null and undefined. "There's an argument among language designers, should we have bottom values at all? But there's nobody who thinks you should have two of them."

According to InfoWorld, Crockford "also presented a scenario with JavaScript being turned into a purely functional programming language by getting rid of 'impurities' like date, the delete operation, math.random and object.assign. Afterward, he stressed replacing JavaScript rather than adding functional capabilities to it... The next language also should be better able to deal with multiple cores. Most languages have followed the sequential model of Fortran, executing one operation after another, he said. 'That's not how the world works anymore. We now have lots of cores available to us, which all want to be running at the same time.'"

In other news, Crockford also proposed ending the "spaces vs. tabs" debate by simply eliminating tabs altogether.
This discussion has been archived. No new comments can be posted.

Douglas Crockford Envisions A Post-JavaScript World

Comments Filter:
  • tabs4lyf (Score:5, Insightful)

    by fuo ( 941897 ) on Saturday March 04, 2017 @06:37PM (#53977579)
    Crockford also proposed ending the "spaces vs. tabs" debate by simply eliminating tabs altogether.

    You go to hell and you die.

    • Re: (Score:3, Insightful)

      by Anonymous Coward

      After 33 years of working as a programmer, I think you're wrong. Junior devs just don't grok tabs. They interchange tabs and the wrong number of spaces and even worse, mix them. I gave-up long ago on tabs and just started using spaces. That's the only way you can work well with people not smart enough to understand tabs.

      • by epyT-R ( 613989 )

        If your junior 'devs' don't understand the fucking tab key, then wtf are they doing writing code for you? This explains why so much of today's software is badly executed... bloated buggy messes.

        • by Junta ( 36770 )

          There is this infestation of 'Junior' (cheap and you get what you pay for) developers in the industry. I'm not saying 'Junior' as in starting out their career and with some guidance they will get better, I'm saying people over a decade into their career and still hopeless, and therefore cheap and persistently cheap.

          Too much management thinks that picking the right process means they can get decent result out of whatever people they feel like, under insane collaboration constraints like 12 hour offset in ti

      • by AmiMoJo ( 196126 )

        That's why spaces-to-tabs and code beautification are essential features of any editor.

        You get a single "why did you commit every file in the repo with no visible changes?!" and form then on it's pretty much invisible maintenance when you edit individual lines.

        Or just don't let anyone else work on your code, that's the easiest option.

    • Re:tabs4lyf (Score:4, Insightful)

      by Actually, I do RTFA ( 1058596 ) on Saturday March 04, 2017 @07:34PM (#53977819)

      Yeah, that's like me "proposing an end to emacs/vi war" by suggesting everyone uninstall emacs*. It bakes in the side you want to win.

      *I flipped a coin. No way was I going to reveal a real preference on such a hotly contested issue.

      • *I flipped a coin. No way was I going to reveal a real preference on such a hotly contested issue.

        Oh, come on! Skeletal integrity is so overrated.

      • That's because you used a devil coin!! You toss that coin into a volcano right now, you hear!?

        I am actually an emacs fan... See now that's bravery... :ducks and runs:

    • by Jamu ( 852752 )
      I agree. If I use tabs for indention I don't care about the number of spaces they're equivalent to. The setting is also tied to the editor, and not the code, so if you look at my code on your editor, the code will have your favored indentation length.
      • Re: (Score:3, Informative)

        by Waffle Iron ( 339739 )

        The problem is that if you look at the code in any tool other than your favorite editor, it's probably displayed with 8 spaces per tab, which is annoying and stupid.

        Tabs should be completely eliminated. They are a obsolete vestige left over from mechanical teletypes. If people want to adjust the apparent indent amount while they edit code, then text editors should be enhanced with a feature to scale any leading spaces on each line to arbitrary widths. There's no need to hard-code text files with special inv

        • by tepples ( 727027 ) <tepples.gmail@com> on Saturday March 04, 2017 @09:33PM (#53978217) Homepage Journal

          Tabs should be completely eliminated. They are a obsolete vestige left over from mechanical teletypes.

          "Completely" is a strong word. I can understand using spaces for indentation, but if you "completely" eliminate tabs, you break compatibility with POSIX Make. Furthermore, if you "completely" eliminate tabs, then what format for delimited flat files? In my experience, tab-separated values format is more efficient than comma-separated values format because a value is far more likely to need escaping because it contains a comma than because it contains a tab.

          • I really meant eliminated from source code. If you want to store tabular data, maybe tabs would be OK. However, ASCII '\x1E' (record separator) would seem to be even more appropriate.

            The use of tabs in POSIX make was an epic failure. Instead of using visually indistinguishable spaces and tabs to mean two separate things, they should use some visible character for the current leading space use, and use any number of leading spaces instead of tabs.

            • No, the record separator is used to separate records, aka lines.
              As "replacement" for tabs you would use FS, the field separator, one char in ASCII behind or before the record separator.
              Well, considering that you could have line feeds in a field, take the "line above" figurative.

          • by phantomfive ( 622387 ) on Sunday March 05, 2017 @01:25AM (#53978805) Journal
            The solution is easy. The tab character is ascii 0x09. We can remove it, and slide down all the other ascii characters to match and fill in the hole. For example, ascii 'A' would go from 0x41 to 0x40. People can just rewrite their software to handle the new character set, and then the world is cleaner and easier. And don't talk to me about backwards compatibility that's how we get messy software to begin with, lazy people unwilling to refactor to keep things clean. All we need to do is refactor ascii: the benefit is that unicode being a subclass inherits the change automatically OOP is soo cool.
            • Re: (Score:2, Funny)

              by Anonymous Coward

              The solution is easy. The tab character is ascii 0x09. We can remove it, and slide down all the other ascii characters to match and fill in the hole.

              Great, we even have an opening for a new ASCII character in 0x7F ! how about some kind of special character for programmers to help them manage indentation levels more easily, like a space but without having to press space n times! that way we also eliminate the debate about how many spaces is the correct level of indentation.

            • Har har har har!

              On a cloudy (but surprisingly warm) sunday, you made me laugh again (y).

          • by djinn6 ( 1868030 )

            if you "completely" eliminate tabs, you break compatibility with POSIX Make

            Syntactically important tabs is the worst part of Make. God help you if your editor shows tab and spaces in the same way. I for one would be glad when that "feature" is gone.

            In my experience, tab-separated values format is more efficient than comma-separated values format because a value is far more likely to need escaping because it contains a comma than because it contains a tab.

            If you want space-efficiency, compress them before writing to disk. You'd get far more savings that way.

        • by The_Noid ( 28819 )

          Yes! Lets change all editors to add a feature so that people can change a setting to make indentations show in the size they want, instead of just using the feature any decent editor already has that allows people to show indentations in the size they want.

          If you're changing all editors you should just implement Elastic Tabstops (http://www.nickgravgaard.com/elastic-tabstops/), since that's the best way to indent code.

        • Which tools except editors do you use to "look at code"?

        • by Junta ( 36770 )

          text editors should be enhanced with a feature to scale any leading spaces on each line to arbitrary widths

          Nice idea, but will fall apart with the convention of tab indentation to indicate code block, then spaces to visually align continuation.

        • by AmiMoJo ( 196126 )
          The great thing about tabs is that you can set them to whatever width you like and the indented code looks fine. No arguing, everyone can have their own preferred setting, even if it is wrong.

          Coding conventions can facilitate this. People say you need spaces to make stuff align, but you don't.

          if (
              condition1 ||
              condition 2
          )

          Looks good with any tab setting, everyone is happy.
      • I agree. If I use tabs for indention I don't care about the number of spaces they're equivalent to. The setting is also tied to the editor, and not the code, so if you look at my code on your editor, the code will have your favored indentation length.

        Chances are it'll look like crap on anything but your tab width, unless you never do any daring stuff like breaking long parameter lists into multiple lines or some such.

        • The right way to do it is tabs to the point of indent, and spaces thereafter.
          • The right way to do it is tabs to the point of indent, and spaces thereafter.

            Yeah, and how do you do that reliably and automatically? Does your editor know what constitutes the indent in every language that you're using?

            • Emacs can do it in a lot of languages.
            • I have my editor set up to display tabs, so I get a nice coloured shape for the indent level on the left. Spaces to the left aren't coloured, so I get a stronger visual clue for indentation than alignment. You can't do this if you're using the same character for indentation and alignment.
    • Re: (Score:3, Insightful)

      by Anonymous Coward
      spaces for spaces
      tabs for indentation
    • I'm in the tabs but not spaces camp.

  • I really don't care which one someone prefers, what I can't stand is not having a standard translation between the two. I wish IDE's, programming languages, and text editors would just pick an arbitrary value like 4 spaces = 1 tab and stick to it. Then, we could let people use whichever they choose.
    • But you can use a regular expression to replace tabs with spaces or the opposite way around? That's what i do anyway, generally i don't see tabs, spaces or positioning of curly braces as issues at all. People have their arguments but its not worth mentioning as its easily solved with one command in say vim or whatever powerful ide does regex. Even better yes please to an entire ecosystem of languages. Its one of the fundamental flaws of software engineering. We bend the spoon because we don't have time
      • Even better yes please to an entire ecosystem of languages. Its one of the fundamental flaws of software engineering.

        At work, I write game and engine code in C++, some platform-specific Mac stuff in Objective-C, tools in C#, all managed by a build system written in Java, customized with Python, and Bash and Powershell scripts, with a web interface in Javascript. And that's just the languages I've interacted with myself.

        Domain-specific or specialty languages work great in other industries, so don't blame it on "software engineering". This is problem for web developers.

      • But you can use a regular expression to replace tabs with spaces or the opposite way around?


        user@host:~/code $ git log --stat

        commit: 10048
        user: tabluvr
        message: replace idiotic spaces with tabs
        files changes: 10000
        lines changed: 1000000

        commit: 10047
        user: spaces4eva
        message: fix broken tab formatting by replacing with spaces
        files changes: 10000
        lines changed: 1000000

        commit: 10046
        user: tabluvr
        message: fix mangled indentation from previous commit
        files changes: 10000
        lines changed: 1000000

        commit: 10045
        user: spaces4eva
        message: replace tabs with spaces
        files changes: 10000
        lines changed: 1000000

        (more)

    • That is not insightfull, but ignorant.
      In every IDE and that includes "low level editors" like vi/vim you can decide in the settings how many spaces are "displayed" for one tab.

  • Why on Earth? (Score:4, Interesting)

    by Anonymous Coward on Saturday March 04, 2017 @06:50PM (#53977637)

    >also presented a scenario with JavaScript being turned into a purely functional programming language by getting rid of 'impurities' like date, the delete operation, math.random and object.assign.

    Getting rid of those things does not make JS a functional programming language.

    Also, writing in purely functional languages just fucking sucks, they aren't and won't ever be a multi-core-coding panacea, and if highly-parallel-performance computing is your concern for the future, being ignorant to how parallel processing environments work by "letting the compiler decide" isn't going to make things better.

  • for the kinds of simple data driven apps JavaScript is used for. The current single threaded model + callbacks works just fine for the most part, and promises solve most of the syntax nightmares (e.g. the Pyramid of Doom). I don't need to play Quake 5 written in JavaScript. That's what C's for.

    As for the rest of his complaints, well, it's mostly there for backwards compat. Don't use it if you don't want to.
    • by tepples ( 727027 )

      I don't need to play Quake 5 written in JavaScript. That's what C's for.

      Until you find that a program written in C was compiled for an instruction set and operating system other than that of your computer. Then what do you do?

  • by Uranium Willy ( 4880351 ) on Saturday March 04, 2017 @07:07PM (#53977717)
    We need a standardised virtual machine that languages can be compiled to run on, that way the language of choice is more free to change. And Web browsers developers can deal with a simpler virtual machine language to translate.
    • by robmv ( 855035 ) on Saturday March 04, 2017 @07:22PM (#53977773)

      WebAssembly [wikipedia.org]

    • How about Parrot [parrot.org] ? It is the Perl 6 VM, a Javascript implementation is in the works, several other languages are also being developed.

    • by Gravis Zero ( 934156 ) on Saturday March 04, 2017 @08:32PM (#53978007)

      We need a standardised virtual machine that languages can be compiled to run on

      NO!!! What we need is for people stop using scripting to turn web pages into applications when 99.99% of the time I JUST WANT TO READ THE GODDAMNED WORDS ON THE PAGE!

      • by Tablizer ( 95088 )

        NO!!! What we need is for people stop using scripting to turn web pages into applications when 99.99% of the time I JUST WANT TO READ THE GODDAMNED WORDS ON THE PAGE!

        Much of it is marketing me-to-ism as people have to copy the UI fads of other sites to look "with it". A focus on logic, simplicity, and practicality of UI's and pages has been shot in the head point blank.

        • Almost everything with UI can be done properly using CSS3. The only thing missing are animation actions and then it would be complete.

          • The next thing missing are animation actions

            FTFY. If you go down that road, it'll never stop. There's always going to be one more feature that's missing, and with new features comes bugs, and with bugs come security holes.

            At the end of the day, you need something that's Turing-equivalent, so you can recombine known features in new and interesting ways. I just hope CSS doesn't end up being that Turing-equivalent something.

      • We could do that, but then how will we feed you advertisements?

    • Some would JavaScript is already the web browser's VM. There's no reason why a VM has to execute bytecode. Why not javascript as "bytecode?" If the coder never sees it then what difference does it make? There is no shortage of languages that compile to JavaScript if you want something more your flavor: CoffeeScript, TypeScript, python, haxe, dart, kotlin, etc. many of these are statically compiled with type checking, etc. Insofar as web assembly, it's a waste of time. Reinventing the wheel. Java, .NET CLR
  • I'd like to have some of the same medication that Douglas Crockford is on, but in a smaller dose.

  • by Snotnose ( 212196 ) on Saturday March 04, 2017 @08:30PM (#53977997)
    In the last 40 years I've used lots of languages from BASIC to Z80 assembly, 8080 assembly, 8086 assembly, 68k, C, awk, sed, sh, perl, C++, TCL/Tk, ADA, Python, Java, Javascript. Some I really liked (assembly, C), some I used with trepidation (C++, perl), some I actively hated (TCL/Tk, ADA).

    But the one and only language that I felt was actually working against me was javascript. Damned script would pass all my tests, then fail on someone else's machine because they chose different options when installing, or had a different version, or just reasons. Note my scripts wouldn't actually fail, as in an error message. No, they just gave the wrong damned results.

    I fucking hate Javascript with a passion and wish it would die by the end of the year.
    • by SendBot ( 29932 ) on Sunday March 05, 2017 @01:40AM (#53978817) Homepage Journal

      As a dev who primarily works in JS, I'm extremely curious to hear about this! When I talk about limitations of JS, I point out the shortcomings (lack of native 64-bit integer support, or anything other than its singular "number" type is a big one), their workarounds, then conclude by saying it will probably be addressed in the future. The ecmascript standards are very well specified, and compatibility is well mapped out.

      Are you talking about node.js by chance? I'm confused about what was "installed" and what options were available. Normally js runs in a browser, and there's not much in the way of options when installing those. Are you talking about the language itself, or the environment such as npm modules?

      I like to criticize c# myself, but I think the complaints more accurately pertain to the .net framework.

      Please share some details, because I love to know about JS caveats and pitfalls and share them with others. Without this information, they sound like pebkac issues.

      Wishing for JS to die out is for wusses. Why not be proactive about killing it off with a better alternative for browser providers to implement? What would you suggest? Samsung has a lot invested in their Tizen OS, and they're not about to abandon that any time soon.

      • by Raenex ( 947668 )

        Could be he's talking about client-side scripting and the DOM and not the language proper.

        • by SendBot ( 29932 )

          Yeah, testing for browser compatibility is such a hassle, and it's better than it's ever been, but sucks how IE's (non-edge) js engine is so slow!

          I think you're right though. OP would say the same thing about Java if he had to deal with same bullshit I ran into during the visual j++ years when MS was in full embrace-and-extend mode. I probably still have the binaries they're not legally allowed to distribute in case of compatibility emergency.

    • +1
      I can learn a new language relatively fast. Any language, except for JS.
      This clusterfuck of a language would rather return something than throw an error. Bugs appear apparently out of nowhere, because some data has been passed in the wrong format for the last 10 functions.

      As an example :
      '1' + 0.1 is '10.1'
      but
      '1' - 0.1 is 0.9

      Then comes a JS 'expert' telling you "It's perfectly normal! It's been described in ECMAScript clusterfuck Specification"

      Just for fun :

      Arra

  • We have been living in the PostScript world for quite some time.

  • Many programming people are aware of Richard Gabriel's essays on why C and related languages became the dominant programming paradigm (
    https://www.jwz.org/doc/worse-... [jwz.org]). In essence, sometimes those ugly compromises are just what people really want (or even need).

    Many have argued that JavaScript is a excellent example of this phenomenon, but there's one big difference. Everybody is trying to replace JavaScript. Some are bolting on new keywords to the language, others are pushing features and some have just

  • by MostAwesomeDude ( 980382 ) on Saturday March 04, 2017 @11:23PM (#53978551) Homepage

    Okay, so this might be a bit of a ramble. Hi, I'm one of the developers of Monte https://monte.rtfd.org/ [rtfd.org], a new programming language based on E. E http://erights.org/ [erights.org] is a language from the 90s. Crockford worked on E. E's TermL mini-language became JSON. Another person who worked on E was Mark Miller. Miller's thesis project was formalizing and describing systems built with E. Crockford and Miller both are part of the committees that steer JS.

    Now, to bring it all together: Object capability security is a security discipline based on the principle of least authority and perfect encapsulation. It allows us to build secure distributed computations with pretty good security properties; wf-stringe can prove that certain data cannot be exfiltrated, that certain I/O cannot happen, and that certain computations are arbitrarily safe to evaluate. It's not perfect, but it's a massive improvement on the state of things.

    E and Monte, as well as a few other languages like Caja, Pony, and Waterken, are object-capability languages. Just like languages without manual memory management cannot misbehave in certain ways, these languages also promise that they cannot fail in certain desirable security-related ways.

    Crockford, Miller, and others have been deliberately steering JS towards more capability-safe constructions. The object model has been tightened up, and tools like weakmaps, promises, and "template strings" (we call them quasiliterals in the literature) have been added. However, JS is still defined by its weak points, and those points are weak indeed.

    Obviously, my bias is towards Monte. It's my preferred language and I want it to be popular. But, more importantly, I want the ideas that went into Monte to be popular. So, in that spirit, I'm going to give you a short list of questions. I want you to think, "How can I do that in my favorite language? Why would I want it?" Monte is meant to be the next Blub http://wiki.c2.com/?BlubParadox [c2.com], the next language that is mediocre but built on a good foundation, and part of that is trying to see how Monte answers questions like:

    • The encapsulation problem: How do I produce an object which perfectly encapsulates a value; i.e. the object refers to a value but referring to the object is not sufficient to gain reference to the value?
    • The concurrency problem: How do I run two interacting plans of code at once?
    • The privacy problem: How do I prove, (in)formally, that a value cannot be exfiltrated from my program except through designated channels?
    • The confused deputy problem: What ambient authority is assigned to a "deputy", a program which can be fooled into misusing that authority?

    ...I've gotta stop writing blog posts on not-my-blog.

  • So...he doesn't like it that there are two ways to declare variables? He doesn't like tabs? He doesn't get out much, does he!

  • Between languages like CoffeeScript and TypeScript and runtimes like WebAssembly, it looks like we have some pretty good ways of evolving gradually into a post-JavaScript world and are on our way there. No need to articulate grand visions.

  • by Terje Mathisen ( 128806 ) on Sunday March 05, 2017 @01:29AM (#53978811)

    I've read all comments as of this time and nobody seems to have taken note of his suggestion about bottom vars:

    "There's an argument among language designers, should we have bottom values at all? But there's nobody who thinks you should have two of them."

    I would like to _strongly_ disagree, you _do_ need two different kinds:

        undefined (Not a Number/Not a Result) which traps if you try to use it, and none which means empty/ignore!

    In the Mill cpu architecture (http://millcomputing.com/) we have those two different kinds and they make coding both easier/more elegant/more compact, and at the same time faster and more secure!

    Another example:

    I am currently on the group that works on the 2018 revision of the IEEE 754 (i.e. floating point) standard. In the original '754 version the "Not a Number" (NaN) type was defined as a way to create a "sticky" error marker in a numeric calculation. I.e. if you accidentally try to calculate 0/0 or Inf/Inf the result will be undefined, the operation might trap or not depending upon how your language runtime is setup, but the result will always be a NaN. There are two kinds of NaNs, Signaling NaN and Quiet NaN, the only difference is that the next time a SNaN is taken as input to an operation it will trap and then be converted to the equivalent QNaN while a QNaN as input will just propagate to the output.

    It should be obvious that if your runtime initializes all FP variables to NaN, then any accidental use-before-load should be detected, right?

    The problem is that for the 2008 (current) revision of the standard, enough people wanted a totally different behavior when searching for the maximum value in an array, typically used to scale a matrix: They managed to define minNum(a,NaN)/maxNum(NaN,b) so as to ignore any quiet NaN val
    ues, always returning the other value. I.e. in those functions they got NaN to behave as None!

    The real problem, and the main reason these functions are going away is how the definition above interact with the SNaN/QNaN rules:

    maxNum(1.0, QNaN) -> 1.0
    maxNum(QNaN, 1.0) -> 1.0

    maxNum(1.0, SNaN) -> QNaN
    maxNum(SNaN, 1.0) -> QNaN

    So if you look for the maximum of 4 values, one of them a SNaN, the result will depend on the order of comparisons, i.e. if you do them pairwise you get this result:

    max(1.0, SNaN, 2.0, 3.0) -> maxNum(maxNum(1.0, SNaN), maxNum(2.0, 3.0)) -> maxNum(QNaN, 3.0) -> 3.0

    while taking alternate inputs results in

    maxNum(maxNum(1.0, 2.0), maxNum(SNaN, 3.0)) -> maxNum(2.0, QNaN) -> 2.0

    I.e. we would have been much better off here with a single bit pattern meaning None which would never propagate.

  • Most languages have followed the sequential model of Fortran, executing one operation after another, he said. 'That's not how the world works anymore. We now have lots of cores available to us, which all want to be running at the same time.'"

    That's pretty ironic, considering Fortran (at least F90 and up) has native parallel programming features. Namely vector/matrix math syntax, which decent compilers can turn into hardware-level parallelism.

  • No Script and Ad Blocker Plus are on all the time on my system. Why aren't they on for yours?

  • Javascript can't die soon enough for my taste.

So you think that money is the root of all evil. Have you ever asked what is the root of money? -- Ayn Rand

Working...