Replies: 4 comments
-
You're proposing to change silently the meaning of I suspect a feature you may be interested in is covariant return types. This would allow you to specify more specific types in subclasses. |
Beta Was this translation helpful? Give feedback.
-
Note that fluent methods don't always return PS: Also, as a syntactic sugar, this messes with typecheck, you should never mess with typecheck. |
Beta Was this translation helpful? Give feedback.
-
Hi all!
Suppose we have Entity:
If need to call both methods, than
I propose adding syntactic sugar to make possible call void-return mehtods in chain:
I think the Compiler can automatically transform the chain
entity.One().Two()
toentity.One(); entity.Two();
.In lambda expressions:
More complex case:
Using:
We must convert explicitly to
CustomBuilder
to callAddCustomRule()
after eachAddRule()
.With auto-fluent syntax sugar it makes it much more easier:
And more usefull usage in extension-methods:
Instead of this:
much more pretty syntax:
if make extension-methods void-return:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions