Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsx in ocaml #162

Closed
bobzhang opened this issue Mar 9, 2016 · 10 comments
Closed

jsx in ocaml #162

bobzhang opened this issue Mar 9, 2016 · 10 comments

Comments

@bobzhang
Copy link
Member

bobzhang commented Mar 9, 2016

for the record, we can do this once we have some basic bindings like React.createElement

[%jsx{|
<div>
  ... { } ...
</div>
|}]
@little-arhat
Copy link
Contributor

Should this be implemented as syntax extension, really? I think, in OCaml, one may define functions for html tags and then combine them, in usual manner, smth like — https://github.com/little-arhat/ocaml-fb-react-playground/blob/master/src/core.ml#L173

@prepor
Copy link

prepor commented Mar 10, 2016

And why do you want react (and syntax extensions around it) in compiler or stdlib? There are many ways to handle UI, including many ways to handle virtual dom, some of them can be much more efficient in functional context than React (see elm's benchmarks). JaneStreet's guys now have some experiments with mixed approach https://github.com/janestreet/incremental.

For me it looks like that such things definitely should be in different/side projects. And we'll help you, guys, with this stuff after release/beta ;)

@bobzhang
Copy link
Member Author

hi, thanks for your comments, this is just to raise some ideas,as you can see, I don't have time to implement it in the short term.

but there are benefits of using a jsx syntax, easy to copy paste existing reactjs code and do static analysis

@bobzhang bobzhang added the ideas label Mar 10, 2016
@prepor
Copy link

prepor commented Mar 10, 2016

@bobzhang you have "React binding" in Beta roadmap (near "Support goog.module"), so I thought it considered as must-have feature :)

but there are benefits of using a jsx syntax, easy to copy paste existing reactjs code and do static analysis

Yes, and it can be done in library (for who want to copy paste react's code)

@bobzhang bobzhang added this to the future- milestone Mar 11, 2016
@Drup
Copy link

Drup commented Jul 27, 2016

(Side note: this is all already implemented: https://github.com/ocsigen/tyxml/)

@bobzhang
Copy link
Member Author

@Drup thanks for your link, I am aware of tyxml, it is slightly different here, jsx is mainly used for vdom(or react bindings), not for plain html

@Drup
Copy link

Drup commented Jul 27, 2016

Tyxml (and its syntax extension) also supports virtual dom via janestreet's bindings (see Virtual_dom.Tyxml). I hope to implement the reactjs API once the bindings stabilizes.

@Drup
Copy link

Drup commented Jul 27, 2016

Just to clarify: Tyxml is not limited to textual html, it's a set of combinators that can be implemented on any html structure. For now, it's implemented on textual html (included in tyxml), dom tree (in jsoo), reactive dom trees (in jsoo with ocaml's React), virtual dom (the one I linked above) and client/server dom with reactive elements (in eliom). For all those structures you get the set of combinators, the typechecking and the html syntax extension directly.

@bobzhang
Copy link
Member Author

maybe delegated reasonml/reason#647

@bobzhang
Copy link
Member Author

bobzhang commented Sep 2, 2016

close it since reason are working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants