5 ms·
Does anyone know if there is work being done to add JSX syntax to C# (either into the language directly or as part of a pre-processor)?
by yodon 9y ago
Does anyone know if there is work being done to add JSX syntax to C# (either into the language directly or as part of a pre-processor)?
- zastrowm 9y agoThe CSharpLang github[1] repository would be where to look for this. I didn't find anything that mentioned adding language support for it, and IIRC, in the past they rejected the idea of inline XML or JSON support. Going the other way of C# inside HTML, you have Razor[2] and Blazor[3], the latter of which is a prototype of Razor running in the browser via web assembly. [1]: https://github.com/dotnet/csharplang https://github.com/dotnet/csharplang [2]: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor https://docs.microsoft.com/en-us/aspnet/core/mvc/views/razor [3]: http://blog.stevensanderson.com/2017/11/05/blazor-on-mono/ http://blog.stevensanderson.com/2017/11/05/blazor-on-mono/
- yodon 9y agoBlazor is pretty amazing, but my coder fantasies mostly revolve around a React-JSX-in-C# vision - the syntax and approach just feel so natural and so right. Your point about rejecting inline XML is probably a pretty good data point that I shouldn’t expect what I’m hoping for to happen.
- pjmlp 9y agoWell, if you would use VB.NET instead, it supports XML literals.
- polskibus 9y agoWhy would you pick jsx instead of TSX?
- yodon 9y agoJSX is the the syntax for embedding HTML in a non-HTML language. TSX is just a file extension implying that the non-HTML language is typescript, which it wouldn’t be here because C#.
- j_s 9y agoInvestigate a possibility to support JSX | https://github.com/bridgedotnet/Bridge/issues/808 https://github.com/bridgedotnet/Bridge/issues/808 Bridge.NET translates C# to JavaScript, but JSX is not currently supported.
- yodon 9y agoI like Bridge.NET but I’m not sure how they will survive once the current Mono WebAssembly tech hits release.
- kevingadd 9y agoWebAssembly does not cover use cases that require a ton of C#<->JS interop, and it may never adequately cover it. You end up needing a very complex interop bridge similar to C<->JS interop. A solution like Bridge can compile to JS, making interop near-zero-cost.
- yodon 9y agoThanks for fantastic answer to my concern (for those who might object that kevingadd didn’t cite his sources, given his background he pretty much -is- a primary source)