News for hackers. Stuff that matters.
Re:Facebook Announces React Fiber, a Rewrite of Its React Fr... by ng12 on Tuesday April 18, 2017 @06:38PM (#14143666)
It was never intended to be supported natively by browsers -- it's syntactic sugar for the React.createElement API. That's what I mean when I say JSX is Javascript.

That issue you linked to is 4 years old and is clearly a reflection of the poster being unfamiliar with React/JSX. The community has since unambiguously decided to avoid inserting more control flow in JSX. Also, I'm not entirely sure what the do/while plugin has to do with JSX.

> I do my templating in template literals

I would argue if you can write your code as easily with template literals as React/JSX your application isn't complex enough to warrant using a framework.

Re:Facebook Announces React Fiber, a Rewrite of Its React Fr... by segphault on Tuesday April 18, 2017 @07:18PM (#14143946)
> That issue you linked to is 4 years old and is clearly a reflection of the poster being unfamiliar with React/JSX

And yet the underlying issues still remain unaddressed. There aren't better ways to handle the cases raised in that issue, which is why people resort to adding additional non-standard syntax to work around the warts.

> Also, I'm not entirely sure what the do/while plugin has to do with JSX.

The "do" keyword is not do/while, it's a non-standard language feature that you can use to turn statements into expressions by wrapping them. It's like using an IIFE with a return value so that you can use a conventional "if" or "for" statement in place in JSX.

> I would argue if you can write your code as easily with template literals as React/JSX your application isn't complex enough to warrant using a framework.

I don't think you really understand how template literals work. Tagged templates can be used for more than just basic string interpolation. You can read more on the subject here: https://appendto.com/2017/02/advanced-javascript-es2015-temp... Or have a look at t7, which uses tagged template literals for virtual DOM templating: https://github.com/trueadm/t7

Re:Facebook Announces React Fiber, a Rewrite of Its React Fr... by ng12 on Tuesday April 18, 2017 @07:43PM (#14144143)
Ah, sorry I misunderstood the plugin. But to the point -- people do all kinds of crazy things in all kinds of languages with all kinds of tools. That doesn't mean there's anything fundamentally broken about them. Now that I know about the existence of the Do plugin I can also definitively say I have no use for it. It's a band-aid for bad code, not a bad framework.

> I don't think you really understand how template literals work

I absolutely do. I use them to internationalize my apps. They're a powerful tool that is not comparable to React/JSX. JSX is not just a template engine which is what you seem to be implying.

Re:Facebook Announces React Fiber, a Rewrite of Its React Fr... by vertex-four on Wednesday April 19, 2017 @10:43AM (#14148025)
To be honest, the lack of it existing in javascript aside, statements-as-expressions is a useful thing - no need to remember the semantics of `if {} else {}` vs `? :`, ability to have very complex (multi-line) expressions, and in languages with RAII, blocks being expressions means it's easy and clear to be able to acquire a resource in order to calculate a single value.
Re:Facebook Announces React Fiber, a Rewrite of Its React Fr... by andrewingram on Tuesday April 18, 2017 @08:25PM (#14144381)
Last I heard (from a twitter thread with those in the know), the "do" keyword is considered highly likely to become standard.