-
Notifications
You must be signed in to change notification settings - Fork 21
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
Allow attributes before the and
keyword
#733
Comments
Yeah this caught me out last week I was perplexed why it didnt work that way. |
10 upvotes if I could. When you have large or more than one attribute, this quickly becomes unreadable presently. I thought I reported this a while ago too, but can't find it back. |
The root cause of this is that [<Struct>]
type Foo = { x : option<Bar> }
and
[<Struct>]
type Bar = { y : option<Foo> }
[<ReflectedDefinition>]
let rec isOdd x =
x = 1 || isEven (x - 1)
and
[<ReflectedDefinition>]
let isEven x =
x = 0 || isOdd (x - 1) This syntax might suggest adding recursive type/let combinations. Not sure if this is a good idea. module AndTest =
type Foo() =
static member f = Bar()
and
let Bar() = Foo.f() |
Just use a |
@dsyme It seems this one is quite easy to add, and it would make it much easier to use attributes on types with It's possible to parse additional attributes in |
We've tried to use it, but found that there're issues in analysis (e.g. dotnet/fsharp#7931) and some things are checked differently with |
Yes, we should fix that issue for sure.... |
Allow attributes before the
and
keywordRight now the only way to add attributes to recursively defined types or values is to put the attribute after the
and
keyword:I propose that we allow putting the attributes before
and
, making this more consistent:and similarly for values:
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: (put links to related suggestions here)
Affidavit (please submit!)
Please tick this by placing a cross in the box:
Please tick all that apply:
The text was updated successfully, but these errors were encountered: