{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1196","repository_url":"https://api.github.com/repos/Microsoft/visualfsharp","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1196/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1196/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/1196/events","html_url":"https://github.com/Microsoft/visualfsharp/issues/1196","id":154905551,"number":1196,"title":"FeedBack Requested: Undeprecate Inline Record definition in Discriminated Union in F# 4.0","user":{"login":"neolem","id":315907,"avatar_url":"https://avatars.githubusercontent.com/u/315907?v=3","gravatar_id":"","url":"https://api.github.com/users/neolem","html_url":"https://github.com/neolem","followers_url":"https://api.github.com/users/neolem/followers","following_url":"https://api.github.com/users/neolem/following{/other_user}","gists_url":"https://api.github.com/users/neolem/gists{/gist_id}","starred_url":"https://api.github.com/users/neolem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neolem/subscriptions","organizations_url":"https://api.github.com/users/neolem/orgs","repos_url":"https://api.github.com/users/neolem/repos","events_url":"https://api.github.com/users/neolem/events{/privacy}","received_events_url":"https://api.github.com/users/neolem/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-15T12:09:35Z","updated_at":"2016-05-18T22:06:23Z","closed_at":"2016-05-18T22:06:23Z","body":"Attempting to define a single case DU with inline records gives a deprecation error. \r\n\r\n```\r\ntype T = T of {a:int; b:string};;\r\n\r\n  type T = T of {a:int; b:string};;\r\n  --------------^^^^^^^^^^^^^^^^^\r\n\r\n.... \\Local\\Temp\\stdin(3,15): error FS0035: This construct is deprecated: Consider using a separate record type instead\r\n```\r\nCould this feature perhaps be un-deprecated? As it is such a useful feature to have when you want to do type-driven-development. Useful because, \r\n\r\n1. The code is concise as you don't have to define a separate type just so that you can use it in a Discriminated type. This feature would nicely complement a use-case where the record type definition is only used in the context of a DU case. In such cases declaring a global record type seems to be redundant and verbose. As F# favors conciseness of code expressiveness, I believe this feature will be welcomed by existing and new F# developers alike. \r\n\r\n2. AFAICT this feature doesn't cause friction with existing F# features but rather enhances F# functional first approach to software development. \r\n\r\n3. It seems Named/Labeled tuple in DU doesn't seem to allow declaring mutable members, for example, this is not possible as of now, ```type t = T of a:mutable int * b: string```. I am assuming since a normal record type allows this, it will also be available in DU record type definition. \r\n\r\n4. Named/Labeled tuple goes some way to enhance readability of code. However, since the name/label doesn't stick(or is not binded strongly as in record member), the same member is labelled differently in different parts of the code. This negates the readability benefit of labelled tuple in a large code-base where each developer can label the same member differently. When reviewing such code one has to frequently refer to the original definition to interpret the meaning behind the label. For example, given a DU ``` type T = T of name:string * age:int.``` A developer can pattern match this without respecting the original label,\r\n```\r\nlet name = function T(field1,_) -> field1 \r\n```\r\nI believe inline record can enforce the naming of the tuple labels more effectively. Additionally one doesn't have to invent new variable names in pattern matches, eg. if F# allows inline records, we can pattern match as such instead,\r\n```\r\nlet name = function T a -> a.name\r\n```\r\n5. Since this feature is deprecated, I am assuming implementation can be revived without too much engineering/development effort.\r\n\r\n6. This feature is available in other ML languages such as SML and Ocaml(4.03) - of which F# also traces its roots and is a continuation of ML tradition - where it is part of the functional programming idiom. This feature will also make it easier to port - in particular- OCAML code to F#. \r\n\r\nIn summary, inline records in DU is such a useful feature that I believe it should be revived in F#. At this point I am curious to know what led to the deprecation of this feature in the first place. Feedback welcome. \r\n\r\nP.S. If this is better served as a language RFC then I can move this issue to F# lang design RFC repo. I am starting here so that I can get some feedback, interest and viability of this feature from MS F# designers/implementers."}}