-
Notifications
You must be signed in to change notification settings - Fork 301
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
[WIP] Plugins come back! #2066
[WIP] Plugins come back! #2066
Conversation
If it can help improve Fable interop I think this is good. I mean using the attribute + plugin combination, we can isolate a specific interop problem and take strong decision to solve as it will not break impact all the code generated by Fable. |
Hi, I would then decorate my declaration with the attribute and it would generate what I am expecting ? |
@CedricDumont Well, you had to write a plugin for that but I think it should be possible. Though it's something I wouldn't personally recommend, as exporting mutable values is dangerous, see #986 |
@alfonsogarciacaro I understand your point about mutable values (and totally agree with you), but...
=> that is my case so the generated javascript from fable might not always be the last step in the build process, and other frameworks might rely on javascript's strange behavior... |
After all the problems we're having with the declaration of React components (see for example fable-compiler/fable-react#195) I'm trying now to implement again a plugin system for Fable (as it was in the very first version), so we can declare components through an attribute (as it's done in ReasonReact) and use some compiler magic to overcome the issues we're having to declare React function components in F#.
This new plugin system tries to solve two of the main problems we had in Fable 1:
In this proposal:
Attributes themselves can become plugins just by implementing an interface and can be declared in the library that needs them.
Another advantage is that (I believe) we can make these plugins work with the JSified Fable so they could work in the REPL too.
It's not done yet, but the idea is in Fable.React we can declare an attribute similar to this:
And use it as follows:
Thoughts? @MangelMaxime @ncave @Zaid-Ajaj @forki et al