{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/123","labels_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/123/comments","events_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/123/events","html_url":"https://github.com/Microsoft/visualfsharp/issues/123","id":55551980,"number":123,"title":"Should FSharpList`1 be sealed?","user":{"login":"KevinRansom","id":5175830,"avatar_url":"https://avatars.githubusercontent.com/u/5175830?v=3","gravatar_id":"","url":"https://api.github.com/users/KevinRansom","html_url":"https://github.com/KevinRansom","followers_url":"https://api.github.com/users/KevinRansom/followers","following_url":"https://api.github.com/users/KevinRansom/following{/other_user}","gists_url":"https://api.github.com/users/KevinRansom/gists{/gist_id}","starred_url":"https://api.github.com/users/KevinRansom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KevinRansom/subscriptions","organizations_url":"https://api.github.com/users/KevinRansom/orgs","repos_url":"https://api.github.com/users/KevinRansom/repos","events_url":"https://api.github.com/users/KevinRansom/events{/privacy}","received_events_url":"https://api.github.com/users/KevinRansom/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/discussion","name":"discussion","color":"207de5"},{"url":"https://api.github.com/repos/Microsoft/visualfsharp/labels/suggestion","name":"suggestion","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-26T23:16:18Z","updated_at":"2015-01-27T16:51:54Z","closed_at":"2015-01-27T16:51:54Z","body":"originally opened at [codeplex](https://visualfsharp.codeplex.com/workitem/119) by [marten_range](https://www.codeplex.com/site/users/view/marten_range)\r\n\r\nInheriting a List<'T> in F# is forbidden:\r\n```fsharp\r\ntype MyList() = \r\n    inherit List<int>()\r\n// Compiler: error FS0945: Cannot inherit a sealed type\r\n```\r\nHowever creative C# developers can do this:\r\n```csharp\r\nclass MyList : FSharpList<int> \r\n{\r\n    MyList () : base(1, FSharpList<int>.Empty)\r\n    {\r\n    }\r\n\r\n    public IEnumerator<int> GetEnumerator ()\r\n    {\r\n        yield break;\r\n    }\r\n}\r\n````\r\nIMHO FSharpList should include the sealed flag to prevent misuse. \r\n\r\nAdding sealed to FSharpList could, I guess, introduce a regression for developers that are overriding FSharpList but I suspect it's a quite rare regression. \r\n\r\nMårten\r\n\r\n>Comments\r\n>dsyme wrote Aug 6, 2014 at 7:25 AM [x] \r\n>I would be happy for the \"Sealed\" flag to be added to this type.\r\n\r\n>>marten_range wrote Aug 7, 2014 at 12:59 PM [x] \r\n>>Tried to add the [<Sealed>] attribute. Didn't work so I will need to dig more into how the assembly metadata is generated. Should be a good exercise.\r\n\r\n>>marten_range wrote Aug 7, 2014 at 2:44 PM [x] \r\n\r\n>>I think I found a place where sealed can be injected for union cases. Seems to work for types like:\r\n>>```fsharp\r\ntype X = | Y |  Z\r\n```\r\n>>However FSharpList1 despise looking like a union to me is generated differently so FSharpList1 don't get tagged sealed.\r\n\r\n>>FSharpLìst1 special cases (like TailOrNull and HeadOrDefault) has surprised me before so if anyone has any tips on how to control the code generation for FSharpList1 that would be very interesting to me.\r\n\r\n>>Thanks."},"comment":{"url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/comments/71682466","html_url":"https://github.com/Microsoft/visualfsharp/issues/123#issuecomment-71682466","issue_url":"https://api.github.com/repos/Microsoft/visualfsharp/issues/123","id":71682466,"user":{"login":"dsyme","id":7204669,"avatar_url":"https://avatars.githubusercontent.com/u/7204669?v=3","gravatar_id":"","url":"https://api.github.com/users/dsyme","html_url":"https://github.com/dsyme","followers_url":"https://api.github.com/users/dsyme/followers","following_url":"https://api.github.com/users/dsyme/following{/other_user}","gists_url":"https://api.github.com/users/dsyme/gists{/gist_id}","starred_url":"https://api.github.com/users/dsyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsyme/subscriptions","organizations_url":"https://api.github.com/users/dsyme/orgs","repos_url":"https://api.github.com/users/dsyme/repos","events_url":"https://api.github.com/users/dsyme/events{/privacy}","received_events_url":"https://api.github.com/users/dsyme/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T16:51:54Z","updated_at":"2015-01-27T16:51:54Z","body":"Since this affects the compiled form of FSHarp.Core.dll, this is a feature request.  Closing this in favour of the F# Language User Voice tracking entry http://fslang.uservoice.com/forums/245727-f-language/suggestions/7017131-make-f-union-types-like-list-that-have-no-subty"}}