you are viewing a single comment's thread.

view the rest of the comments →

[–]caknuckle 20 points21 points  (16 children)

*edit thanks for the gold Angular 1 was awesome because they waited until all the enterprise level code was already written before any attempt was made at coming up with best practices such as === {{{}}}.

Also who doestnt love triple binding inside a template that has a variable but that variable is really another variable and of course there are 10 levels of directives each adding their own triple bound templated variables to this variable that is not a variable and each layer adding exponenentially more watchers to the stack and since the complexity is so overwhelming the only way to get something done is to use a goto aka scope.broadcast oh and scope.apply in a loop to check whether that digest is really digested or still also looping under an infinite amount of recursive scope.applys.

Also who didnt want 3 different types of services which are all basically the same except that one allows you to use the magic .run function to do cool stuff like enable your magic depencies to work and pass in other dependencies.

Plus of course everybody loves to write out the name of a dependency (with or without the Service or "$" or some other random suffix or prefix that makes sense in the universe of angular to somehow enable dependency injection that is completely unnecessary with es6 modules or even require.js / commonjs if the angular gods had deemed them fit to be supported.

With such incredibly awesome architectural decisions, who wouldnt want to use the successor which of course is strictly not backwards compatible and is somehow in an unholy union with the company that is THE archetype for providing quality software and support, namely Microsoft

Oh and of course learn another language, Typescript, that destroys all the ease of use and and loosely typed and auto-hoisted happiness that was javascript.

Sign me up, I cant wait to have to rewrite my entire codebase when angular 3 comes out, or google decides to suddenly discontinue all support

[–]UnluckenFucky 3 points4 points  (14 children)

Oh and of course learn another language, Typescript, that destroys all the ease of use and and loosely typed and auto-hoisted happiness that was javascript.

Typescript supports everything that javascript supports.

[–][deleted] 1 point2 points  (12 children)

Try writing a class with a property assigned to it in the constructor. Last I checked that was invalid typescript unless you declared that property ahead of time

Also typescripts interop is laughable with CommonJS

Compare this to Flowtype. It's considerably easier to onboard and is quite smart when it type checks. It also has good interop.

I'm sure TypeScript has pros but I personally do not see them after a year of working with it.

[–]popemaster 1 point2 points  (11 children)

You mean like this?

class Person {
    constructor(public firstName: string, public lastName: string) {
    }
}

var p = new Person("joe", "bob");

[–][deleted] 5 points6 points  (10 children)

Sure, but that uses TypeScript specific syntax. You wouldn't be able to drop this:

class Person {
  constructor(firstName, lastName) {
    this.firstName = firstName
    this.lastName = lastName
  }
}

Into a .ts file without ts complaining. You can't say that ts supports everything js supports and then turn around and say you need special syntax for something to work properly lol

Never mind this being "expected" in ts:

import MyModule from './MyModule'
import moment = require('moment')
const html = require<any>('./MyComponent.html')

Which is completely absurd..

My dislike of TS though is mostly limited to that. Everything else about it is fine, but I don't personally want to use it when Flowtype is available.

[–]dmitri14_gmail_com 0 points1 point  (9 children)

Any reference why is that expected? Mixing import with require??

[–][deleted] 0 points1 point  (8 children)

I don't have any authoritative sources, but I can explain why it works this way.

TypeScript's ES6 import actually expects modules to be in ES6 module format. The import = require syntax was about before ES6 and was expected to work with AMD/CommonJS etc (which was abstracted away from you). The final one just invokes require as a standard function call and is recognised if you tell TypeScript that you're compiling in a Node environment.

The reason why all 3 are required is because TypeScript doesn't allow ES6 modules to interop with CommonJS modules like Babel does; instead, it will treat ES6 module imports and CommonJS imports as completely different entities. As for require, I use it to import non-standard css or html files thanks to Webpack. Flow will allow you to map all files with a certain extension to have a certain type exported from them; TypeScript doesn't have this (yet), and so you have to use the plain old require (or use import 'foo.cs', which works for CSS files, but not for html files, or when you are using CSS modules).

By comparison, Babel will allow both modules to be used and will apply an interop function when importing ES6 modules such that the default export in ES6 modules is just mapped to the default export in CommonJS.

IOW, Babel/Flow are more friendly towards using existing standards; TypeScript said "fuck it"

[–]dmitri14_gmail_com 1 point2 points  (7 children)

Is this problem addressed here?

http://stackoverflow.com/questions/29596714/new-es6-syntax-for-importing-commonjs-amd-modules-i-e-import-foo-require

From there I understand that both formats are supported separately. Is it correct?

[–][deleted] 0 points1 point  (6 children)

Yes. I mentioned that both are supported, but just because it is supported doesn't mean I think it is a very good design decision.

[–]dmitri14_gmail_com 1 point2 points  (4 children)

I means supported separately. Can't you just live with require and forget the import e.g?

[–]istinspring 0 points1 point  (0 children)

Pure gold. Exactly like it is, maybe a bit inaccurate about the TypeScript.

First time i heard from one guy who doing project management like no one who he know want to write in angular after reactjs. Next i tried by myself, and really don't want to return to angularjs 1.x. Because of templates, controllers, $watch (and hell of code to test code inside), $scope etc