News for hackers. Stuff that matters.
Re:Comparing Ember Octane and React by isakkeyten on Tuesday May 12, 2020 @08:22AM (#23153138)
From a perspective of someone who codes react, what i dont like in ember:

- this this this, so many this keywords

- not a fan of decorators

- constructor and super

- mutability (unless it hides an immutable nature)

- hbs feels weirder to me than jsx

- the fact that you have yet another filetype in your code means even the tiniest components MUST be in more than 1 file, react lets you choose (edit: i rushed, seems there are template literals one can use)

Re:Comparing Ember Octane and React by _630w on Tuesday May 12, 2020 @11:03AM (#23154737)
Tbf, I would gladly take mutability or impureness over unnecessarily complicated approach. One example of it is the suspense api in react. Suspense uses a promise throw approach opposed to generators. Your code throws a promise and suspense catches it to render fallback until it is resolved.

You end up with few ugly situations. First, I hate that I have to wrap my components (what if you want different fallback for different components? You end up with many wraps), how my UI will render is not isolated anymore. I often end up returning loading view from the components as we as well using it as a fallback for suspense. It just feels wrong. I lack control.

Re:Comparing Ember Octane and React by holler on Tuesday May 12, 2020 @12:57PM (#23156291)
for things like loading state with ember we use a library called ember-concurrency that uses the generator approach. It's very nice!

Example you can create some "task" (promise-like), then in a template you have automatic access to it's state so e.g.

``` {{#if this.fetchStoriesTask.isRunning}} loading... {{else}} <span>Loaded 10 Stories</span> {{/if}} ``` https://github.com/machty/ember-concurrency

Re:Comparing Ember Octane and React by mnutt on Tuesday May 12, 2020 @10:00PM (#23162613)
ember-concurrency is probably at the top of the list for things I miss most when writing javascript outside of ember.
Re:Comparing Ember Octane and React by jmisavage on Tuesday May 12, 2020 @08:34AM (#23153244)
A lot of these apply to other frameworks too especially Angular, which has a very unhealthy love affair with decorators.
Re:Comparing Ember Octane and React by searchableguy on Tuesday May 12, 2020 @10:50AM (#23154596)
I am curious where decorators make sense. I find them unreadable with little to gain back so I avoid writing them myself. Class extensions works for most of the use cases of decorators. I guess they are helpful when you need to modify class methods and properties.
Re:Comparing Ember Octane and React by erikrothoff on Tuesday May 12, 2020 @09:28AM (#23153737)
I like and use Ember a lot, but the one gripe I have is that Handlebars uses s-expressions instead of just inline JS. The constant context switch is massive and it’s not possible to hook into Typescript types, and I doubt it ever will.

Would love the possibility to enable a flag to just enable JS-in HBS like

  {{#if this.model.isEnabled(this.byOtherVariable}}
    {{aHelperCall(this.args.thing)}}
  {{/if}}
Kinda like a hybrid of JSX and HBS, but combining the best of both worlds.
Re:Comparing Ember Octane and React by chriskrycho on Tuesday May 12, 2020 @10:47AM (#23154572)
> it’s not possible to hook into Typescript types, and I doubt it ever will

While it's not possible today, it's definitely possible in principle. (Vue is a great example of this!)

The folks working on TS integration in Ember (of whom I am one) are very well aware both of the problem, what it will take to solve it, and what the state of the art is elsewhere. No timelines, but we're working on it and when we're done the experience should be comparable to TSX. All of us working on it think TSX is a killer bit of DX and it absolutely is a thing we're aiming to match.

Re:Comparing Ember Octane and React by erikrothoff on Wednesday May 13, 2020 @07:31AM (#23165776)
Really cool, didn't know Vue had this. It's great that it's in the works, and I'm really really looking forward to it. Will it be statically typed s-expression or more like regular JS? I spoke a bit to pzuraq about this on Reddit and it seems to be still s-expressions going forward?
Re:Comparing Ember Octane and React by chriskrycho on Wednesday May 13, 2020 @12:01PM (#23168266)
What we're aiming for at this point is 100% TS support for the current Glimmer syntax—we expressly want to support Ember and Glimmer usage as they are today. If Glimmer/Ember itself were to move toward supporting something more like the way Svelte's templates work (which is closer to what we could support while maintaining the tradeoffs Glimmer makes relative to JSX), we'd of course move to support that as well, but there's nothing like that planned at the moment.
Re:Comparing Ember Octane and React by sudders on Tuesday May 12, 2020 @03:02PM (#23158220)
This is amazing
Re:Comparing Ember Octane and React by airstrike on Tuesday May 12, 2020 @09:38AM (#23153829)
Honest question, what's so bad about `this`?
Re:Comparing Ember Octane and React by lhorie on Tuesday May 12, 2020 @05:53PM (#23160404)
Dynamic scope[1] is generally considered to be harder to reason about since their values are not determined by where they appear in a file (but rather by how the code executes at runtime)

[1] https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexic...

Re:Comparing Ember Octane and React by jeffkeen on Tuesday May 12, 2020 @04:40PM (#23159449)
OP doesn't like coding in javascript to feel like coding in javascript, I guess.