unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.95k stars 725 forks source link

Is it possible to have F# documentation here? #1529

Open Kavignon opened 5 years ago

Kavignon commented 5 years ago

What would you like to be added:

Show how to build Uno apps with F#.

Why is this needed:

C# isn’t the only language for .NET development and is actually more verbosed. F# functional nature make sense in app development and makes it clearer and less bug-prone when compared to C#.

For which Platform:

Anything else we need to know?

No, thank you for this!

ghuntley commented 5 years ago

👋 You won't need to sell us on the merits of functional programming. I'm a big fan of the church of λ. Anyway this would be a good topic for blog posts and examples. UnoConf.com is coming up next week so there won't be much movement on this until it's over. Happy to help if you want to pitch in?

ps: Jerome did some hacking in this department back in Jan w/Elmish — https://github.com/nventive/Elmish.Uno

GitHub
nventive/Elmish.Uno
Static UWP views for elmish programs running with the Uno Platform - nventive/Elmish.Uno
Kavignon commented 5 years ago

I don't know much about Uno to be honest. I started to go through the documentation and was wondering if F# could be a thing. Nice to know it could very much be a thing! @ghuntley What would be the necessary steps to undertake to get some F# samples good to go? The Uno platform doesn't support native F# code from the get-go? What are the current limitations and what kind of support is required in order to be able to do Uno with F#?

Because from a technical point of view, F# can also do object programming. So it could very much replace the back-end code that any C# would be responsible for. In order to be able to do it while applying the functional nature of F#, that I guess is the part you guys are looking for?

saint4eva commented 5 years ago

Why is this needed:

C# isn’t the only language for .NET development and is actually more verbosed. F# functional nature make sense in app development and makes it clearer and less bug-prone when compared to C#.

Bashing and hating on C# does not make F# any better. You should focus on requesting for F# support than your hatred against C#. If F# is better, they would not have done the project in C#.

F# is a great language and you should use it if it meets your need. C# is also a great language with both OOP and functional capabilities - really an amazing language.

jeromelaban commented 5 years ago

@Kavignon F# is somehow supported for libraries depending on Uno, but is not supported for head projects, and projects that contain XAML files (the source generation tooling creates C#).

As @ghuntley mentioned, I did some investigation a while back to determine the level of support.

For now, we do not have any plan to support F# for XAML and head projects, but making sure we do not break support for F# libraries that depend on the Uno.UI package is of interest.

Kavignon commented 5 years ago

@saint4eva I'm sorry for bad-mouthing C#. I love C# and it's thanks to it that I fell in love with software development. Again, sorry.

I was pointing to the fact that F# can be better suited for a certain kind of tasks. There are certain historical issues to F# such as even though coming from Microsoft, it's never been recognized as a first-class citizen for .NET development until recently.

C# is a fantastic language, but so is F#. I feel seeing two approaches for doing Uno development; then .NET developers could decide which approach feels better for them :)

Kavignon commented 5 years ago

@jeromelaban Long time no talk; it's been a few years! I can see you've created a separated fork for Elmish. What are the current limitations around the F# tooling that makes it not work out of the box and where would you and @ghuntley like to get some support in? I'm no expert, but I'd love to help a bit here! Uno looked pretty cool and was thinking some F# doc could be great to see for the F# community

isaacabraham commented 5 years ago

@saint4eva I'm really not sure where the hating you're talking about is. The OP has simply asked about contributing F# documentation and justified his opinion as to why he thinks it's valid to consider it.

jeromelaban commented 5 years ago

At this point, a few things can be done:

kierepka commented 5 years ago

I'm using Fabulous and I think it's good direction to support Uno via this library.

aammfe commented 4 years ago
  • It was brought to my attention that Fabulous has now been refactored to lift the dependency to Xamarin.Forms out in a separate assembly, and adding Uno support for it may now be possible, but this would need to be investigated first.

Hello!! any news ?

jeromelaban commented 4 years ago

Some experimental Uno Fabulous work has been done here: https://github.com/unoplatform/uno.fabulous

GitHub
unoplatform/uno.fabulous
Contribute to unoplatform/uno.fabulous development by creating an account on GitHub.
xperiandri commented 4 years ago

@jeromelaban is this code for WebAssembly only?

jeromelaban commented 4 years ago

@xperiandri at this point because it was an experiment, yes it's only for wasm but it's possible to make this work for iOS and Android as well.

xperiandri commented 4 years ago

@Kavignon, for now, more or less working sample is https://github.com/xperiandri/Elmish.Uno except #3973

GitHub
xperiandri/Elmish.Uno
Static UWP views for elmish programs running with the Uno Platform - xperiandri/Elmish.Uno
charlesroddie commented 3 years ago

Has anyone made an F# Uno app?

The Uno docs suggest that there is a shared projects which is included in the head projects at build time. As far as I can tell, types then get different interpretations depending on which head project they belong to. Since F# does not have shared projects and cannot be head projects, this architecture is inapplicable.

Is it possible to define Uno views in F#?

xperiandri commented 3 years ago

try dotnet new -i "Elmish.Uno.ProjectTemplates.Dotnet::1.0.0-ci-*" --nuget-source "https://www.myget.org/F/elmish_uno/api/v3/index.json"

xperiandri commented 3 years ago

F# cannot work with UWP until .NET 5. So for now, only WinUI 3 desktop apps can be built purely with F#

xperiandri commented 3 years ago

In my opinion building UI in F# is absolutely impractical. Especially if you know XAML and Blend. Trying to create item templates for a ListView or any other items control and writing code to reuse them in a UI virtualization scenario is a hardly usable thing.

So my approach is to explicitly define states per the single responsibility Elmish program which corresponds to visual states in XAML. This way you always sure that UI is in a consistent state and corresponds to your Elmish state. In contrast to what usually happens in MVVM when a lot of UI states are spread across a huge ViewModel class.