{"action":"created","issue":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/6517","repository_url":"https://api.github.com/repos/crystal-lang/crystal","labels_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6517/labels{/name}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6517/comments","events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6517/events","html_url":"https://github.com/crystal-lang/crystal/issues/6517","id":349494599,"node_id":"MDU6SXNzdWUzNDk0OTQ1OTk=","number":6517,"title":"Feature request: add a `macros` method to `@type`","user":{"login":"Flink","id":5648,"node_id":"MDQ6VXNlcjU2NDg=","avatar_url":"https://avatars0.githubusercontent.com/u/5648?v=4","gravatar_id":"","url":"https://api.github.com/users/Flink","html_url":"https://github.com/Flink","followers_url":"https://api.github.com/users/Flink/followers","following_url":"https://api.github.com/users/Flink/following{/other_user}","gists_url":"https://api.github.com/users/Flink/gists{/gist_id}","starred_url":"https://api.github.com/users/Flink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flink/subscriptions","organizations_url":"https://api.github.com/users/Flink/orgs","repos_url":"https://api.github.com/users/Flink/repos","events_url":"https://api.github.com/users/Flink/events{/privacy}","received_events_url":"https://api.github.com/users/Flink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-10T12:20:30Z","updated_at":"2018-08-10T13:16:28Z","closed_at":null,"author_association":"NONE","body":"I’ve been trying to find an easy way to check that a macro is defined for a given scope but it seems there is no way of doing that in the current version of Crystal.\r\nAfter discussing quickly the issue on the Crystal gitter, @straight-shoota suggested to open a feature request about this.\r\nSo the idea would be to have a `#macros` method available on `@type` when writing macros, allowing to easily list the macros defined in the current scope. My personal use case is to check if a set of macros is defined (or not) when including a particular module into a class for example. I have no clue however if this is something hard to implement or not (I could try to help though)."},"comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments/412079013","html_url":"https://github.com/crystal-lang/crystal/issues/6517#issuecomment-412079013","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/6517","id":412079013,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMjA3OTAxMw==","user":{"login":"straight-shoota","id":466378,"node_id":"MDQ6VXNlcjQ2NjM3OA==","avatar_url":"https://avatars0.githubusercontent.com/u/466378?v=4","gravatar_id":"","url":"https://api.github.com/users/straight-shoota","html_url":"https://github.com/straight-shoota","followers_url":"https://api.github.com/users/straight-shoota/followers","following_url":"https://api.github.com/users/straight-shoota/following{/other_user}","gists_url":"https://api.github.com/users/straight-shoota/gists{/gist_id}","starred_url":"https://api.github.com/users/straight-shoota/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/straight-shoota/subscriptions","organizations_url":"https://api.github.com/users/straight-shoota/orgs","repos_url":"https://api.github.com/users/straight-shoota/repos","events_url":"https://api.github.com/users/straight-shoota/events{/privacy}","received_events_url":"https://api.github.com/users/straight-shoota/received_events","type":"User","site_admin":false},"created_at":"2018-08-10T13:16:28Z","updated_at":"2018-08-10T13:16:28Z","author_association":"CONTRIBUTOR","body":"It should be pretty easy to implement. I'm not to sure about the usefulness, though.\r\nBut, currently there is `Crystal::Macros::Macro` available in the macro language yet no way to access such a value. Unless it is directly provided as argument to a macro call like `my_macro macro foo; end` but that's probably not very useful."}}
{"actor":{"display_login":"straight-shoota"}}