Skip to content
New issue

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

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

Already on GitHub? # to your account

Adapting to changes in C#14 (Extension Types) #792

Open
FreeApophis opened this issue May 29, 2024 · 4 comments
Open

Adapting to changes in C#14 (Extension Types) #792

FreeApophis opened this issue May 29, 2024 · 4 comments

Comments

@FreeApophis
Copy link
Member

FreeApophis commented May 29, 2024

C#14 has some new features which impact Funcky in a fundamental way: we probably want to introduce new API in a 3.x Version, but I think the old API should be phased out and removed in a 4.0 Release.

Changes which might impact Funcky:

implicit and explicit extensions

ParseExtensions could be static extensions to make the Parse*OrNone functions be visible on the type.

string.ParseInt32OrNone could be int.ParseOrNone()

We could make the Asserts more discoverable by statically extend Assert in XUnit:

  • FunctionalAssert.Ok could be Assert.Ok

Sequence could be entirely done as a static extension on Enumerable.

  • We could use an explicit Some<T>-Extension-Type as an explicit type to "hide" GetOrThrow()
Some<T> some = option;
var value = some.GetOrThrow();

Let's collect the ideas for new features, adapted features and how to move on here.

@FreeApophis
Copy link
Member Author

AFAIK implementing interfaces is out of scope for C#13 but we could also look if the list pattern support of Option<T> could be extracted into an extension, since it relies on duck typing and not on an interface.

@bash
Copy link
Member

bash commented May 29, 2024

I saw the presentation about extensions and got really excited about the possibilities for Funcky 🎉

I bet that we could also do some fun things with properties that we can't right now (i.e. have <Property>OrNone properties on System. objects that turn nullability into options.

@FreeApophis
Copy link
Member Author

Extension types will come with C#14 - so we won't change much this year and release a 3.5.

https://devblogs.microsoft.com/dotnet/csharp-13-explore-preview-features/#update-on-extension-types

@FreeApophis FreeApophis changed the title Adapting to changes in C#13 Adapting to changes in C#14 (Extension Types) Sep 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants