Title: A few improvement/discussion points of the `PSMethod -> Delegate` conversion work · Issue #5618 · PowerShell/PowerShell · GitHub
Open Graph Title: A few improvement/discussion points of the `PSMethod -> Delegate` conversion work · Issue #5618 · PowerShell/PowerShell
X Title: A few improvement/discussion points of the `PSMethod -> Delegate` conversion work · Issue #5618 · PowerShell/PowerShell
Description: This is about #5287 DelegateArgsComparator.ParameterTypesMatches doesn't consider the Variance in delegate parameter types. A method signature int CallMe(object input) should be able to be converted to Func
Open Graph Description: This is about #5287 DelegateArgsComparator.ParameterTypesMatches doesn't consider the Variance in delegate parameter types. A method signature int CallMe(object input) should be able to be converte...
X Description: This is about #5287 DelegateArgsComparator.ParameterTypesMatches doesn't consider the Variance in delegate parameter types. A method signature int CallMe(object input) should be able to be conv...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/5618
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A few improvement/discussion points of the `PSMethod -\u003e Delegate` conversion work","articleBody":"This is about #5287\r\n\r\n- [x] `DelegateArgsComparator.ParameterTypesMatches` doesn't consider the Variance in delegate parameter types. A method signature `int CallMe(object input)` should be able to be converted to `Func\u003cstring, int\u003e`.\r\n- [x] `PSMethod.MatchesPSMethodProjectedType` doesn't handle the case where both `targetType` and `projectedSourceType` are the same `ByRef` type or `Pointer` type.\r\n- [x] I think the 'Unit' type name should be changed to 'VOID'. Use type `Unit` to represent `void` is not intuitive and I misread it to `uint` when first looking at the code.\r\n- [x] I don't get the point of having `ReplaceGenericTypeArgumentsWithMarkerTypes`. After making a generic method using our synthetic reference/value types, the generated `MethodInfo` signature won't match any real delegates except in one condition -- the original generic method doesn't use the generic type argument for any of its parameters or return type -- I think it's rare for this condition to be met for a generic method.\r\n- [x] I agree that we need pseudo types to represent `ByRef` type (ref/out), `Pointer` type `void` type and even `TypeReference`, but why do we need `PSEnum\u003c\u003e` to wrap enum types? Remove `PSEnum\u003c\u003e` and use the enum type directly.\r\n- [ ] Handle method signatures with `Span\u003cT\u003e` or `ReadOnlySpan\u003cT\u003e` as its parameter type or return type. They cannot be used as type argument, and therefore we cannot use them directly to construct a generic type of `Func\u003c\u003e`. In fact, this is a more general problem with all ref-like types, such as `public ref struct Foo { private Span\u003cint\u003e _pointer }`. It would be great if we can have a generic solution for all ref-like types, but at least we need to handle `Span\u003cT\u003e` and `ReadOnlySpan\u003cT\u003e` as they are getting more and more usage. See the discussion comments: https://github.com/PowerShell/PowerShell/pull/6851#discussion_r188111503","author":{"url":"https://github.com/daxian-dbw","@type":"Person","name":"daxian-dbw"},"datePublished":"2017-12-04T19:09:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/5618/PowerShell/issues/5618"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7b8d650e-0d0f-3247-538c-c5d078f94bcf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E60A:21FDDF:1F5DCB6:2D8B733:6A54ECDC |
| html-safe-nonce | e6f1d93cf1e83b7e72b171fbdb3bbff2b36e5b0c61b854481836fedd47a2d11b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjBBOjIxRkRERjoxRjVEQ0I2OjJEOEI3MzM6NkE1NEVDREMiLCJ2aXNpdG9yX2lkIjoiNjAyMjQ5ODc3NTk3Njk2MzI5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4667e012d265a6e026f02a280ade9bc7f66c1a7176934f2faa628e822ff1f28b |
| hovercard-subject-tag | issue:279112467 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/5618/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8480f7404044a7c7f1324f9462166153a662c180f7fa487da586a64638d69d53/PowerShell/PowerShell/issues/5618 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8480f7404044a7c7f1324f9462166153a662c180f7fa487da586a64638d69d53/PowerShell/PowerShell/issues/5618 |
| og:image:alt | This is about #5287 DelegateArgsComparator.ParameterTypesMatches doesn't consider the Variance in delegate parameter types. A method signature int CallMe(object input) should be able to be converte... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daxian-dbw |
| hostname | github.com |
| expected-hostname | github.com |
| None | eae2aab99907699a22d2c8449aa683ca74454fca87211b98f7c7b722086b2839 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bb1b4ffdc07c66de20ad344214f55df0aa364bd3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width