-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
Nxui + F# #21
Comments
I think we can add some options to generator to create namespace with camelCased extensions for FSharp and create separate nuget. |
I also wonder does F# support implicit usings like C# ? https://github.com/AngelMunoz/NxuiFsharp/blob/3ae45981fa36669077c8772198f2004a2c4b82db/src/NxuiFSharp/Counter.fs#L4-L5 NXUI has this https://github.com/wieslawsoltes/NXUI/blob/main/src/NXUI/ImplicitUsings.props |
F# does not support implicit usings (due to shadowing behavior), there is one suggestion in the suggestions repo but nothing concrete and usable today. |
I think we should be able to close this for the moment I'll ping back if something else comes by |
Ok |
@AngelMunoz future updates of dotnet SDK are likely to have the feature to resolve the extension methods (with Please consider if it would be worth preparing the ground the guidance provided to users of this repository, there are several strategies that could be discussed. What would be most helpful to the compiler IMO would be to have the current generator issue an F# library that is compiled using the preview compiler, that would directly call in the extension methods, and have the methods decorated with obsolete attribute inviting NXUI users to use We may wait for the tooling to consume a version of FCS that has the feature in it, just so the autocomplete shows both property and extension method. Defining the migration steps in the documentation would also be necessary for this to be smooth to everyone. |
Hey there!
I managed to try out NXUI with F# and I think it may be a really good choice for F# devs, there are some aspects that are not so F#'ish which I think it is definitely expected and I personally don't mind.
I have a code sample here in case you want to check it out by yourself
https://github.com/AngelMunoz/NxuiFsharp
This is general feedback in my little tinkering and PoC I plan to actually use it further just to have a better feel
Overall I think it feels good, the ease of interop with observables is just lovely I'm going to dive deep with that I'm sure, it is quite simple to start composing the UIs here and I think it also lends itself to "UI widgets as functions" e.g. just have a function that calls the builders you need for that section of the screen and voila! you have something working cool and nice ready to work with.
One thing that is not so F#'ish is the use of out vars F# doesn't have that handy syntax to declare the out var and have it available at that point, so if you have to use those you need to create the mutable variable in advance e.g.
Now, personally this is not a killer for me, I can live with it as F# tends to be quite explicit when you're doing mutable stuff like this and enforces rules to avoid doing the wrong thing (e.g.
inref<'T>
,outref<'T>
,byref<'T>
) but it can be something someone would point at as not "F#'ish enough"That being said, one can also do
So as I said, nothing to worry about, I guess with some guidance it can be avoided
The only main issue with NXUI as is to work smoothly with F# out of the box is the following
Type Extensions not recognized by the F# compiler
Extension methods with the same name of an existing property are not recognized from the F# side More info here: Prefer extension methods to intrinsic properties when arguments are provided fsharp/fslang-suggestions#1039
The suggestion is approved in principle and it should eventually get fixed if someone picks it up, in the meantime I don't know if the generator project can be adapted to produce an "FSharp" namespace with camelCased extensions or if we need to modify to generate a different assembly and publish that separately.
In any case I can take a look and attempt to do it if we agree to something
From there on I think I need to keep experimenting more to have a better feel but even with the type extensions thing
I really like this piece of work, kudos to you!
The text was updated successfully, but these errors were encountered: