Giter VIP home page Giter VIP logo

discriminatedunion.cs's Introduction

Hi ๐Ÿ‘‹ My name is George

Backend developer. ITMO OOP mentor.

  • Fourth year ITMO University student
  • .NET developer at Ozon
  • Head backend developer at Omyonic
  • Tutor at ITMO University

Lot of work needs a lot of rest, so my free time I spend writing C# libraries.

  • ๐ŸŒย  I'm based in Saint-Petersburg, Russia
  • โœ‰๏ธย  You can contact me at t.me/ronimizy

Skills

C# .NET PostgreSQL Swift

Stack

  • ASP.NET Core
  • Entity Framework
  • Roslyn API
  • Blazor WASM

Socials

Badges

My GitHub Stats

ronimizy's GitHub stats

discriminatedunion.cs's People

Contributors

ronimizy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

nwendel

discriminatedunion.cs's Issues

Wrapped types' interface implementation

Discriminators must implement interfaces that wrapped types are implementing.
To avoid compiler confusion all implementations must be an explicit interface implementations.

Named discriminator

API Proposal

The syntax of custom discriminator names

[GeneratedDiscriminatedUnion]
public abstract partial class Result : IDiscriminator<string, Result.Succsess>, IDiscriminator<string, Result.Error>

When generated, if IDiscriminator`2 interface is implemented, second generic argument(not parameter) must be an ErrorTypeSymbol inside the UnionType, so it's name will be taken as Discriminator name. That way, after generation ErrorTypeSymbol would be resolved.

Requirements

  • An ability to give custom names to discriminator.
  • An analyzer of proper IDiscriminator`2 interface implementation.
  • An analyzer of conflicting names (eg: discriminators of same type, discriminators of types of same name from different namespaces, discriminators with same custom name).
  • Accomodate changes in ExhaustiveSwitchSuppressor

Introduce Discriminator type

Most of contexts have discriminator information presented by properties:
DiscriminatorName
WrappedTypeSymbol
WrappedTypeName

It should be United in Discriminator type.

Add conversions support

  • Make implicit conversion from WrappedType -> DiscriminatorType
  • Make implicit conversion from DiscriminatorType -> WrappedType
  • Make implicit conversion from WrappedType -> UnionType

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.