back to article Improving JavaScript: Google throws AtScript into the mix

Google’s Miško Hevery, co-inventor of the popular AngularJS framework, has announced a new project to improve JavaScript by adding type annotations and other features. Miško Hevery presents AtScript Miško Hevery presents AtScript at ngEurope The announcement came at the ng-europe Angular conference in Paris at the end of …

  1. Anonymous Coward
    Anonymous Coward

    Oh god, if this ends up being as unnecessarily complex and arbitrary as Angular, you might as well stick with basic JavaScript.

    Sledgehammer, meet nut.

    I much prefer the knockout.js nutcracker and Typescript is scarily usable. This looks like classic Not Invented Here syndrome.

    1. Malcolm 1

      While not exactly best friends it is rather a shame that Google couldn't just work with Microsoft to enhance Typescript in a compatible way rather than introducing their own flavour.

  2. JDX Gold badge

    Why don't the various major browser manufacturers just agree to add a proper language in their browsers, i.e. JS 2.0 or something? It would take a long time but we got there with HTML5 in the end.

    1. Tom 7

      Most (if not all of this) this was available in JS2 2006 or so.

      Certain companies didn’t want it even though they could have had it more or less for free - they didn’t join the committee to allow the language to do things easily.

      If people could see what you could do in a browser with JS2 and some SVG with attitude...

      1. JDX Gold badge

        Re: Most (if not all of this) this was available in JS2 2006 or so.

        Considering how all major players are clamouring how their browser is the new fastest JS machine...

    2. h4rm0ny

      Typescript is licenced under the Apache 2 licence and is a standard. So there's no non-technical reason why they couldn't use it.

      As to the technical reasons why you would use it... The annotations perhaps...? I'm struggling to see much if any need for Runtime Introspection in a language designed to run in the browser. I've seen some sophisticated client-side applications these days so... maybe? But I can't think of any real reason why you'd want it and I can see it mainly being used by some far too clever programmers to write code that everyone who inherits their project stares at and backs away from.

      So chiefly I see its use being impregnable job security. No doubt and Objective C programmer will appear to tell me why it's actually useful here. ;)

      1. Anonymous Bullard

        I'm struggling to see much if any need for Runtime Introspection in a language designed to run in the browser

        Serialisation - both ways (and validation rules can be provided in annotations), without needing to write code for every class.

        1. Tom 7

          Reply Icon I'm struggling to see much if any need for Runtime Introspection in a language

          Makes an in-browser IDE a lot easier.

          But you could do that with JavaScript anyway so its nothing new.

        2. h4rm0ny

          >>"Serialisation - both ways (and validation rules can be provided in annotations), without needing to write code for every class."

          Interesting. Seems a bit of an extreme reason to make a new language but thanks for answering the question. I was struggling to see any need for this.

          1. wikkity

            RE: I'm struggling to see much if any need for Runtime Introspection in a language

            A lot of people said the same when it was introduced into java. A trivial but common example for a web page would be annotate a variable with a min/max value, a framework can then example that the validate data entry.

  3. Dan 55 Silver badge

    Could just we do the obvious thing and just make a JS editor/IDE which enforces type declaration in the source code instead of reinventing the wheel for the nth time?

    1. Malcolm 1

      Isn't that exactly what Typescript does?

      1. dogged
      2. Dan 55 Silver badge

        I don't believe so as there is extra TypeScript syntax and a compilation stage from TypeScript to JavaScript.

        1. dogged

          the only extra syntax is the fat arrow (which is in ECMAScript 6.0) and type declarations, so basically, no.

          1. Dan 55 Silver badge

            It's still not plain JavaScript though. I mean an editor that would preprocess the source and pick up the type from the initial declaration of the variable (from its value) or from a comment and enforce that type throughout the program.

            In fact Google already took the comment approach in another project but they do like to reinvent the wheel.

            https://developers.google.com/closure/compiler/docs/js-for-compiler

            If you wanted to expand on the concept you could make the editor barf over what is considered bad-style JavaScript (e.g. See the book 'JavaScript - The Good Parts').

  4. Anonymous Coward
    Anonymous Coward

    Ooops

    'That said, the absence of language features like types and classes make large, multi-developer JavaScript projects hard to maintain.'

    That is absurd, language features have almost nothing to do with maintainance. Its the way the code is written and documented that mainly affects maintainance.

    Far too many people simply repeat the 'take this pill and everything will be ok' approach.

    You can write bad code using classes and types just as easily when not using classes and types.

    Sorry but there is no easy fix to bad code, and forcing a particular style on bad coders may make the code even worse.

    1. captain veg Silver badge

      Re: Ooops

      This is all true. What the author meant to says is "the absence of language features and classes make JavaScript projects hard to maintain for large teams of barely competent (but cheap) programmers who need protecting against themselves." We rockstar coders can continue writing framework-free uber-code using ed.

      -A.

      1. Alistair
        Joke

        Re: Ooops

        bah.

        echo "Line_of_obfuscated_Complicated_Code" >> sourcefile

        Who needs an editor.

    2. Notas Badoff

      Re: Ooops

      Two different quotes I reference:

      The difference between prose and poetry is not that different languages are used, but that the same language is used, differently.

      Elegant or ugly code as well as fine or rude sentences have something in common: they don't depend on the language.

    3. Brewster's Angle Grinder Silver badge

      Re: Ooops

      It can help if the language has one clear way of doing something. Perl, for example, has three ways of doing everything so every programmer does it differently or every team has a massive document saying thou shalt program this way which new programmers have to master. And there is a retraining cost if the approach a language uses to solve a problem is different to the standard one.

      That said, I love programming with closures. And find I rarely need to stray into prototypes.

      1. 27escape
        WTF?

        Re: Ooops

        Its not just perl that can do things many ways, its letting the developers do whatever they want thats the problem.

        If you set coding and development standards (for any language) then everyone develops against those, these should not be set in stone but reviewed every now and again to make sure that you are working against the language best practices.

        If you only have one or two developers then they will (generally) do things their own way and redevelop the bicycle in arcane ways, thats also what developers do.

        I have seen bad code in many languages.

        One of perl's problem is peoples perception of it as a quick and dirty hack language, so when using it for quick scripts that is the way those people code, rather than understanding the language and coding as they would in their preferred language.

        Another issue is that people cut/paste old code from the internet that is not a good example of running and then bodge around it, this happens in all languages.

        For example, my ruby code is shocking and would be considered doing things the wrong way by awesome ruby developers.

    4. Harry Kiri

      Re: Ooops

      Nope, its not absurd - have you heard of assembly? Why do you think we have compiled high level languages in the first place?

      Rather than retype common sense, check out: http://stackoverflow.com/questions/2684364/why-arent-programs-written-in-assembly-more-often

      Perl can be a dog to maintain and thats due to its features.

      The practicality of code is that its hardly ever documented and pretty much the documentation is wrong (usually APIs are well documented but the code behind isnt).

      And yes you can write poor code in any language - but pound for pund, I'd still rather not have to deal with well written js.

  5. Ken Hagan Gold badge

    Wrong on so many levels

    Point one: You can't fix an inelegant language by adding features. Just about every widely used programming language ever proves this point. One of the good bits about HTML5 is its attempt to kill off some abusive contructs by saying "OK, the browser has to accept this, but the validator doesn't and it isn't HTML5 unless the validator says so".

    Point two: JavaScript already has "types and classes" in the form of duck typing and prototype-based objects. That's actually a powerful language feature for small scale programming. Adding C++-style objects to the language will spoil the system for those who like it and fail to satisfy you because the old stuff will still be there. AND you'll have to produce a detailed specification for how the two systems relate. (Oh joy!)

    Point three: If you want a classful language for writing client-side, platform independent web apps, be aware that it will probably never catch on. Java already exists, is well-specified and up until a few years ago it was almost universally deployed. Even with that "head start", it failed to catch on. Why should your new language be different?

    1. Brewster's Angle Grinder Silver badge

      Re: Wrong on so many levels

      I disagree with point 3. javascript catching on was a historical anomaly and had nothing to do with whether or not it had classes.

    2. dogged

      Re: Wrong on so many levels

      > Adding C++-style objects to the language will spoil the system for those who like it and fail to satisfy you because the old stuff will still be there. AND you'll have to produce a detailed specification for how the two systems relate. (Oh joy!)

      Not really - Typescript manages this with dynamic typing and the Any type.

    3. Tom 7

      Re: Wrong on so many levels

      Re Point two? Bollocks- It wont spoil things - bad project management would. Types and classes would make thing a lot easier for a lot of people.

  6. Anonymous Coward
    Anonymous Coward

    Very Complex

    I rather use javascript DOM for webpages.

    Desktop(non-windows) rules !

  7. Rich 2 Silver badge

    JS is shote

    Title says it all really. Writing in a language to have it converted into another? The huge numbers of frameworks and abstraction layers designed to try and plaster over JS's problems? It's a joke. JS is awful in pretty much every way - it's got a stupid object model (I use the term loosely - a bit like JS does); 'this' may as well refer to a bloody penguin for the good it does. It offers no compile -time help witth types. Etc etc etc.... It is crap and is unlikely to improve without some major changes which basically means rewriting the whole ugly thing. We should bite the bullet, agree on a better alternative (anything will do!) and let JS die off.

    1. Richard 92

      Re: JS is shote

      Yes, we *should*. But, of course, it's not going to happen, at least, not for many, many years to come.

      Whether we like it or not, JS is the lingua franca of the web. It is essentially the 'assembler' language of the browser. Everything we develop has to eventually execute as JS.

      This may change in another 20 or 30 years. Maybe. But in the meantime, we have to use *something* to write our browser-based applications with.

  8. Anonymous Coward
    Anonymous Coward

    Stop trying to proprietise the web. Propose a new standard via W3C.

    1. Jason Bloomberg Silver badge

      I am not convinced the intent is to deliberately proprietise the web, more wanting to deliver a useful and usable solution quickly without becoming bogged-down in delays while trying to agree a new standard and arguing how it should be.

      "If you don't like it; fork it", has both advantages and disadvantages.

  9. Yorkshen

    New, newer.. newest.. or just another..

    JaveScript.. or ***Script.. if it is just some sort of text which is blasted inside your browser - it's just another mess. anything which is based on JavaScript ideology is just another mess which kids to play around with.

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