Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The semantics of the JSX transformation certainly do vary, though there’s a fairly consistent baseline which you’ve broadly matched; yet for all the variations in semantics, the JSX syntax itself is well-defined, and that’s what you’re flouting. In fact, since we’re talking of semantics, one of the ways in which the runtime (post-transformation) semantics vary is a good indication of the problem of special-casing your own syntax: your class syntax transforms into a property named class, but React uses className for the equivalent concept.

JSX(input.search, {}, null) makes perfect sense as code and as a concept, though that particular combination of names would be surprising. But suppose it’s something like props.tagName, or library.SomeComponent. As for your JSX(Input-Search, {}, null) being module lookup… I hope that wouldn’t be valid code, and that <Input-Search/> transforms into something other than that, or you’ve got grave problems. But again, this is a point where you’ve deviated from standard JSX syntax in a way that’s far too likely to cause trouble down the road. Why not rather use Module:Component or module.Component, both of which are syntactically valid JSX? (I dunno if these modules are global or have to be imported or whatever, so I don’t know what’s most appropriate.)

Concerning hyphens in keys: I’m referring to what you’re suggesting as a possible addition to your brand of JavaScript. I’m suggesting that it would be better if you resisted the temptation to alter JavaScript at all, beyond possibly standard JSX syntax.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: