You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any expression it might be virtually impossible to parse by styled-ppx, but we can “stop parsing” until a matching ) appears.
Another approach is trying to run the "current parser" as a single expression inside the interpolated value, I'm unsure how to do this since embeding ReScript/OCaml/Reason parsers is not an option (would bloat the binary)
metaquote uses a trick where [%expr] is the ppx, and [%e ] can be placed inside expr for any expression. Errors are tricky, and DX seems bad. Similar case is https://github.com/stedolan/ppx_stage
The last idea is to have a mini parser for only function calls in OCaml/Reason and ReScript that we support, similar on how ppx_str works https://github.com/AriaFallah/ppx_str/blob/master/src/ppx/ppx_str.ml and warn the user about it, so they can always extract into a function.
The text was updated successfully, but these errors were encountered:
Explore how difficult is to support any expression inside the interpolation syntax.
Any expression it might be virtually impossible to parse by styled-ppx, but we can “stop parsing” until a matching
)
appears.Another approach is trying to run the "current parser" as a single expression inside the interpolated value, I'm unsure how to do this since embeding ReScript/OCaml/Reason parsers is not an option (would bloat the binary)
Other ppxes that support some sort of expression interp is because the entire payload is valid: https://github.com/thierry-martinez/metapp.
metaquote uses a trick where
[%expr]
is the ppx, and[%e ]
can be placed inside expr for any expression. Errors are tricky, and DX seems bad. Similar case is https://github.com/stedolan/ppx_stageThe last idea is to have a mini parser for only function calls in OCaml/Reason and ReScript that we support, similar on how ppx_str works https://github.com/AriaFallah/ppx_str/blob/master/src/ppx/ppx_str.ml and warn the user about it, so they can always extract into a function.
The text was updated successfully, but these errors were encountered: