Adam Tolley (2) [Avatar] Offline
#1
I feel that labeling ng directives as a DSL is confusing at best.

Firstly, HTML is already a domain specific, declarative language. Angular extends the syntax of this existing language in a predictable fashion, such that additional keywords are akin to names of functions in an API, not language extensions.

Secondly the argument that react does not leverage DSL, when JSX is exactly that, is very confusing.

Thirdly, React's approach to components seems very similar to tag-level ng directives at the markup level ( at least as of the first half of chapter 1 ) and making an argument of one versus another seems to muddy the waters considerably.

I would recommend steering clear of the claim, even if it feels justified, as it is a distraction to the subsequent point about not separating the structure and action of UI component into template and script.
Adam Tolley (2) [Avatar] Offline
#2
NG Directives as a DSL - self rebuttal
On further reading and thinking, I guess I can see your point.

The built in ng-directives, and the filter syntax is, or might as well be, a DSL, as are templating languages.

And furthermore, JSX is a DSL, but a very thin one that amounts to syntactic sugar - again, at least as far as I have seen.

I am just a bit wary on introducing the concept of DSL vs not DSL out of the gate, as its a very overloaded term. The examples speak for themselves nicely though.

Perhaps I am being pedantic or over-literal, but this _is_ a book written for programmers. :/

Azat Mardan (41) [Avatar] Offline
#3
I'm glad examples helped. I'm sure as you continue thru the book and continue to use React in your project, you'll see that JSX is just a shortcut and you can use JavaScript in it which simplifies things.

My main dislike of ng is that let's say I need to use ng-repeat... what is trackBy? How do I know this syntax? What is trackBy's function signature? Why colon and not equal sign? I need to know this from the docs or examples.

Not the exact syntax:
<div ng-repeat="let i = index; trackBy: (whatIsThis)=>{}" .../>

http://stackoverflow.com/questions/36322829/how-to-use-track-by-inside-ngfor-angular-2

---

Azat, author of React Quickly