{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corert/issues/5951","repository_url":"https://api.github.com/repos/dotnet/corert","labels_url":"https://api.github.com/repos/dotnet/corert/issues/5951/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corert/issues/5951/comments","events_url":"https://api.github.com/repos/dotnet/corert/issues/5951/events","html_url":"https://github.com/dotnet/corert/issues/5951","id":332973931,"node_id":"MDU6SXNzdWUzMzI5NzM5MzE=","number":5951,"title":"$BlockedFromReflection instead of name of type","user":{"login":"FoggyFinder","id":16510738,"node_id":"MDQ6VXNlcjE2NTEwNzM4","avatar_url":"https://avatars2.githubusercontent.com/u/16510738?v=4","gravatar_id":"","url":"https://api.github.com/users/FoggyFinder","html_url":"https://github.com/FoggyFinder","followers_url":"https://api.github.com/users/FoggyFinder/followers","following_url":"https://api.github.com/users/FoggyFinder/following{/other_user}","gists_url":"https://api.github.com/users/FoggyFinder/gists{/gist_id}","starred_url":"https://api.github.com/users/FoggyFinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FoggyFinder/subscriptions","organizations_url":"https://api.github.com/users/FoggyFinder/orgs","repos_url":"https://api.github.com/users/FoggyFinder/repos","events_url":"https://api.github.com/users/FoggyFinder/events{/privacy}","received_events_url":"https://api.github.com/users/FoggyFinder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-06-16T09:09:49Z","updated_at":"2018-06-18T12:34:33Z","closed_at":null,"author_association":"NONE","body":"When I try to do the follow (name for type of some type):\r\n\r\n```csharp\r\nvar tp = typeof(Int32).GetType();\r\nConsole.WriteLine(\"Name = {0}\", tp.Name); \r\n```\r\n\r\nI get the next result:\r\n\r\n```\r\nName = $BlockedFromReflection_0_0dc86273\r\n```\r\n\r\nI guess it has to be `RuntimeType` (at least this result I get when run via `dotnet run`)\r\n\r\n---\r\n\r\nI found the #5838 perhaps it's related."},"comment":{"url":"https://api.github.com/repos/dotnet/corert/issues/comments/398039078","html_url":"https://github.com/dotnet/corert/issues/5951#issuecomment-398039078","issue_url":"https://api.github.com/repos/dotnet/corert/issues/5951","id":398039078,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODAzOTA3OA==","user":{"login":"zpodlovics","id":8523206,"node_id":"MDQ6VXNlcjg1MjMyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/8523206?v=4","gravatar_id":"","url":"https://api.github.com/users/zpodlovics","html_url":"https://github.com/zpodlovics","followers_url":"https://api.github.com/users/zpodlovics/followers","following_url":"https://api.github.com/users/zpodlovics/following{/other_user}","gists_url":"https://api.github.com/users/zpodlovics/gists{/gist_id}","starred_url":"https://api.github.com/users/zpodlovics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpodlovics/subscriptions","organizations_url":"https://api.github.com/users/zpodlovics/orgs","repos_url":"https://api.github.com/users/zpodlovics/repos","events_url":"https://api.github.com/users/zpodlovics/events{/privacy}","received_events_url":"https://api.github.com/users/zpodlovics/received_events","type":"User","site_admin":false},"created_at":"2018-06-18T12:34:32Z","updated_at":"2018-06-18T12:34:32Z","author_association":"NONE","body":"Oh I see. ```typeof<'T>``` in fsharp is an operator in F#:\r\nhttps://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/prim-types.fs#L448\r\n\r\nAs F# always generalizes the function types to operate as widely as possible on multiple types. The 'T (X in your example) may not yet know by the developer, but will be solved (statically) by the compiler with type inference during the compilation.\r\n\r\nYou can have a generic zero creation function that could work on all types:\r\n\r\nhttps://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/prim-types.fs#L2489\r\n\r\nF# REPL:\r\n```\r\nMicrosoft (R) F# Interactive version 4.1\r\nCopyright (c) Microsoft Corporation. All Rights Reserved.\r\n\r\nFor help type #help;;\r\n\r\n> Microsoft.FSharp.Core.LanguagePrimitives.GenericZero<int>;;           \r\nval it : int = 0\r\n\r\n> Microsoft.FSharp.Core.LanguagePrimitives.GenericZero<float>;;\r\nval it : float = 0.0\r\n\r\n type MyType() = static member get_Zero() = MyType();;         \r\ntype MyType =\r\n  class\r\n    new : unit -> MyType\r\n    static member get_Zero : unit -> MyType\r\n  end\r\n\r\n> Microsoft.FSharp.Core.LanguagePrimitives.GenericZero<MyType>;;\r\nval it : MyType = FSI_0006+MyType\r\n\r\n```\r\n\r\nAnd it also allows type based metaprogramming and / or specialization like this:\r\nhttps://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/seq.fs#L1067\r\n\r\nAnd this (if you define a type in F#, the compiler will automatically generate for you the generic equality functionality):\r\n\r\nhttps://github.com/Microsoft/visualfsharp/blob/70dee190c8f393dd5fc4652754423c70f746f70b/src/fsharp/FSharp.Core/prim-types.fs#L2086\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"zpodlovics"}}