-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapse member val to member #1062
Comments
Just to mention you can already just use just type IA =
abstract X: int -> int The main problem with |
Brilliant! I didn't consider just trying it out. That's 1 more I could update in the Language Reference. Should I make an issue in https://github.com/dotnet/docs first or just PR?
As a new F# learner (from other MLs) ... |
Just PR please :)
Yup, understood. |
In other words, |
Oh I see your point. If I only include read-only properties from my table: abstract VirtualProperty with get // not defined yet
member val ImplicitProperty = expr with get // explicitly eager
member ImplicitProperty = expr with get // implicitly eager (proposed)
member _.ReadOnlyProperty = expr // implicitly deferred
member _.ExplicitProperty with get () = expr // explicitly deferred Then without the self identifier
The self identifier (unlike the
In retrospect the lack of a self identifier or function arguments is what led me to expect property shorthand to be eager. Now I see the logic behind
I agree my proposal is mutually exclusive with #626. If this is ultimately rejected I think I should try to help communicate the |
Another good thing we can do is proper hover-tips over all keywords in typical IDEs |
The |
Collapse
member val
tomember
and abstract method to abstractCopied from #523 (comment) (closed discussion: more consistent and more simple syntax).
I propose the compiler parse
member
in place ofmember val
in property shorthand declaration.Likewiseabstract
in place ofabstract method
in virtual method declaration.The existing way of approaching this problem in F# is ...
I'm currently reading through the Language Reference (which is missing a couple things noted in my linked comment) and particularly struggled to gain an intuition about member syntax. I arrived at:
let
is effectively private.val
is an uninitialized field (except formember val
).abstract
(+is virtual.member
for methods)member
(+val
for property shorthand) is sealed(except for.abstract member
)default
andoverride
follow the same pattern asExplicitProperty
andSealedMethod
.static
can prefix any non-virtual declaration.The only confusing cases were
member val
and. If accepted my columns would collapse into a single keyword per concept and be useful in documentation:abstract member
Pardon me if this should've been posted in another forum 🙏🏼
Pros and Cons
The advantages of making this adjustment to F# are ...
The disadvantages of making this adjustment to F# are ...
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: None
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.
The text was updated successfully, but these errors were encountered: