Default Value Operator #2087
Replies: 10 comments
-
Right now the LDM is considering just allowing you to write things like |
Beta Was this translation helpful? Give feedback.
-
Can you send the link to those details? I'm curious how this is going to be achieved; which I believe is a good idea; but if it's only for |
Beta Was this translation helpful? Give feedback.
-
What other scenarios are do you need this for? Can you update the OP with those examples? |
Beta Was this translation helpful? Give feedback.
-
I assume you're referring to #1865? |
Beta Was this translation helpful? Give feedback.
-
@CyrusNajmabadi I am the OP... but yes I'll update the proposal with others. I have mocked up examples but didn't want to clutter it up. Having |
Beta Was this translation helpful? Give feedback.
-
@yaakov-h No, that's not the proposal. Maybe I shouldn't have used |
Beta Was this translation helpful? Give feedback.
-
Would that work with |
Beta Was this translation helpful? Give feedback.
-
@dsaf structs are less of a problem, since separate specialized methods are compiled for struct generic parameters. I'm more worried about |
Beta Was this translation helpful? Give feedback.
-
Is it possible to did that lifting with |
Beta Was this translation helpful? Give feedback.
-
@MichaelPuckett2 Actually I think what you want is #889 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Allow types to declare default values in the same way we use custom operators today.
Accessing the default value could be something now exposed via property but it could also be a shortcut to an existing property.
Using
Nullable<T>
for example but not only for NullableCurrently you can compare or assign with custom operators but you still have to access
Value
directly.Using a
Nullable<T>
for example:Currently looks a little like this:
Operator might look something like this:
Now you could access
Value
with a double dot operator making it easier to read and a bit more common for other types doing the same thing.Beta Was this translation helpful? Give feedback.
All reactions