You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is one issue regarding user-defined types: #41, however, our idea of how the user-defined types should look changed quite a bit. I will summarize here what we came up with and what we are missing.
This issue will be updated with new ideas, things we still need to figure out...
Syntax
State
We would have two types of classes:
Braced classes
Paren classes
Braced classes
For non-POCO usecases (actual OO design)
No constructor provided implicitly
Expected to write factory functions
Initialization through the initializer syntax
Only state is described here, meaning auto-props and fields
Essentially named tuples, mainly targeting POCOs (exposed data-structures, utility-types)
Order of the state is exposed
Primary ctor that can be used for initialization
Only state is described here, meaning auto-props and fields
class Bar(// Gettable and settable auto-proppublicvarX: int32,// Get-only auto-proppublic val Y:string,// Mutable fieldinternal field var Z: int32,// Readonly fieldpublic field val W:string);
Logic
Any associated behavior of the type is described within a logic block. The logic block can be thought of associating members with a type (not necessarily an instance of the type). Multiple logic blocks can be specified for a type, essentially making this very similar to extension methods.
logicFoo{// 'This' keyword is an implicit alias to Foo// Static factorypublicfuncmake(): This = This { ...};// Member methodpublic func toString(this):string= ...;// Associated value, AKA. static field, property, ...
private field var instanceCount: int32;}// Implementing a trait, interface or base class
logic IComparable<Bar> for Bar {// Only members are allowed here that are present in IComparable<Bar>}
Member functions
Non-static functions take this parameter while static does not, otherwise, they look the same as free functions.
Properties
Non-static properties take this parameter while static do not.
Properties allow for declaring backing fields inside their scope, which means the backing fields are not visible anywhere outside the prop.
The set accessor has implicit value parameter.
There is one issue regarding user-defined types: #41, however, our idea of how the user-defined types should look changed quite a bit. I will summarize here what we came up with and what we are missing.
Syntax
State
We would have two types of classes:
Braced classes
For non-POCO usecases (actual OO design)
Paren-classes
Essentially named tuples, mainly targeting POCOs (exposed data-structures, utility-types)
Logic
Any associated behavior of the type is described within a
logic
block. Thelogic
block can be thought of associating members with a type (not necessarily an instance of the type). Multiple logic blocks can be specified for a type, essentially making this very similar to extension methods.Member functions
Non-static functions take
this
parameter while static does not, otherwise, they look the same as free functions.Properties
Non-static properties take
this
parameter while static do not.Properties allow for declaring backing fields inside their scope, which means the backing fields are not visible anywhere outside the prop.
The
set
accessor has implicitvalue
parameter.The text was updated successfully, but these errors were encountered: