modular-framework icon indicating copy to clipboard operation
modular-framework copied to clipboard

Contracts type narrowing

Open piotr-lasota opened this issue 1 year ago • 0 comments

Scope

Types narrowing for IContract related registration and Contract<T>

#Justification

IContractRegistry

Current constraints allow for any class to act as a type parameter for .Register<T>() method. As this would not work I want to improve the developer experience by allowing the compiler to indicate that a given invocation is not supported

Contract<T>

Semantically contracts are intended to validate messages exchanged between modules. Narrowing down the type constraint helps to enforce those sematics.

piotr-lasota avatar Sep 30 '22 06:09 piotr-lasota