{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/3169","repository_url":"https://api.github.com/repos/PowerShell/PowerShell","labels_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/3169/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/3169/comments","events_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/3169/events","html_url":"https://github.com/PowerShell/PowerShell/pull/3169","id":208606236,"number":3169,"title":"Dynamic keyword metadata reader","user":{"login":"rjmholt","id":7009879,"avatar_url":"https://avatars1.githubusercontent.com/u/7009879?v=4","gravatar_id":"","url":"https://api.github.com/users/rjmholt","html_url":"https://github.com/rjmholt","followers_url":"https://api.github.com/users/rjmholt/followers","following_url":"https://api.github.com/users/rjmholt/following{/other_user}","gists_url":"https://api.github.com/users/rjmholt/gists{/gist_id}","starred_url":"https://api.github.com/users/rjmholt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjmholt/subscriptions","organizations_url":"https://api.github.com/users/rjmholt/orgs","repos_url":"https://api.github.com/users/rjmholt/repos","events_url":"https://api.github.com/users/rjmholt/events{/privacy}","received_events_url":"https://api.github.com/users/rjmholt/received_events","type":"User","site_admin":false},"labels":[{"id":486892834,"url":"https://api.github.com/repos/PowerShell/PowerShell/labels/Review%20-%20Needed","name":"Review - Needed","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":{"login":"daxian-dbw","id":127450,"avatar_url":"https://avatars2.githubusercontent.com/u/127450?v=4","gravatar_id":"","url":"https://api.github.com/users/daxian-dbw","html_url":"https://github.com/daxian-dbw","followers_url":"https://api.github.com/users/daxian-dbw/followers","following_url":"https://api.github.com/users/daxian-dbw/following{/other_user}","gists_url":"https://api.github.com/users/daxian-dbw/gists{/gist_id}","starred_url":"https://api.github.com/users/daxian-dbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daxian-dbw/subscriptions","organizations_url":"https://api.github.com/users/daxian-dbw/orgs","repos_url":"https://api.github.com/users/daxian-dbw/repos","events_url":"https://api.github.com/users/daxian-dbw/events{/privacy}","received_events_url":"https://api.github.com/users/daxian-dbw/received_events","type":"User","site_admin":false},"assignees":[{"login":"daxian-dbw","id":127450,"avatar_url":"https://avatars2.githubusercontent.com/u/127450?v=4","gravatar_id":"","url":"https://api.github.com/users/daxian-dbw","html_url":"https://github.com/daxian-dbw","followers_url":"https://api.github.com/users/daxian-dbw/followers","following_url":"https://api.github.com/users/daxian-dbw/following{/other_user}","gists_url":"https://api.github.com/users/daxian-dbw/gists{/gist_id}","starred_url":"https://api.github.com/users/daxian-dbw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daxian-dbw/subscriptions","organizations_url":"https://api.github.com/users/daxian-dbw/orgs","repos_url":"https://api.github.com/users/daxian-dbw/repos","events_url":"https://api.github.com/users/daxian-dbw/events{/privacy}","received_events_url":"https://api.github.com/users/daxian-dbw/received_events","type":"User","site_admin":false}],"milestone":null,"comments":22,"created_at":"2017-02-18T02:49:58Z","updated_at":"2018-02-22T19:40:23Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/PowerShell/PowerShell/pulls/3169","html_url":"https://github.com/PowerShell/PowerShell/pull/3169","diff_url":"https://github.com/PowerShell/PowerShell/pull/3169.diff","patch_url":"https://github.com/PowerShell/PowerShell/pull/3169.patch"},"body":"This PR adds a new entry point for defining `DynamicKeyword`s to PowerShell. Where currently these can be added at runtime in PowerShell, this now uses CIL metadata in an assembly as a specification of the syntax requirements, and performs some validation of the specification.\r\n\r\nI've also added the concept of nested keywords -- there are keywords that will only be parsed and invoked as keywords when they are in the scope of another keyword. This seemed like a common feature in Domain Specific Languages we've been looking at.\r\n\r\nI still need to do some work on this PR, but I want to get the ball rolling because it's a substantial addition.\r\n\r\nWork to still to do includes:\r\n\r\n- Making the tests work on Linux. I didn't want to submit before this happened, but the errors are in module loading (module paths) and Add-Type (\"Could not load type...\") -- so I thought I would ask for advice on this\r\n- Adding a `Types.ps1xml`-like test case\r\n- Adding more tests for UseMode checking, keyword scope, and other DynamicKeyword features\r\n- Adding completions/intellisense for keywords\r\n\r\nI've been doing work on adding `DynamicKeyword` runtime execution using C# code (so a domain-specific language for PowerShell can be defined entirely in a C#/dotnet module/assembly -- see [here](https://github.com/rjmholt/PowerShell/blob/dsl-csharp-prototype/src/System.Management.Automation/engine/parser/DslSpecification.cs) for a very rough prototype), and this PR is essentially the first step toward that. I intend to submit an issue describing the work and a roadmap soon.\r\n\r\nFinally, in this PR, there are some points I think that need special scrutiny:\r\n\r\n- The `UseMode` concept (restricting how many times a keyword may appear in a block) -- it may be unneccessary or unwanted, and is where the metadata reader starts to verge on too opinionated. I included it because it was part of the RFC I submitted.\r\n- The metadata reader type providers -- one uses System.String and the other System.Type, but they could both be consolidated to use a custom type description class. I've seen dotnet core/corefx use a class called [TypeDesc](https://github.com/dotnet/corefx/blob/master/src/System.Private.Xml/src/System/Xml/Serialization/Types.cs#L71), but that might be a bit heavyweight. The type providers are also only partially implemented because some methods are never called -- but it would be nice to fix that.\r\n- Error messages -- I'm not sure what the standard way to report errors to the user is"},"comment":{"url":"https://api.github.com/repos/PowerShell/PowerShell/issues/comments/367796472","html_url":"https://github.com/PowerShell/PowerShell/pull/3169#issuecomment-367796472","issue_url":"https://api.github.com/repos/PowerShell/PowerShell/issues/3169","id":367796472,"user":{"login":"lzybkr","id":2148248,"avatar_url":"https://avatars3.githubusercontent.com/u/2148248?v=4","gravatar_id":"","url":"https://api.github.com/users/lzybkr","html_url":"https://github.com/lzybkr","followers_url":"https://api.github.com/users/lzybkr/followers","following_url":"https://api.github.com/users/lzybkr/following{/other_user}","gists_url":"https://api.github.com/users/lzybkr/gists{/gist_id}","starred_url":"https://api.github.com/users/lzybkr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lzybkr/subscriptions","organizations_url":"https://api.github.com/users/lzybkr/orgs","repos_url":"https://api.github.com/users/lzybkr/repos","events_url":"https://api.github.com/users/lzybkr/events{/privacy}","received_events_url":"https://api.github.com/users/lzybkr/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T19:40:23Z","updated_at":"2018-02-22T19:40:23Z","author_association":"MEMBER","body":"@bergmeister - the reference assemblies contain no code - they are like a header file in C/C++ or an interface definition.\r\n\r\nIt does make sense to produce nuget packages for some of PowerShell like the parser, but it's a ton of work to factor things in a reasonable way to be useful."}}
{"actor":{"display_login":"lzybkr"}}