{"action":"created","issue":{"url":"https://api.github.com/repos/p4lang/p4c/issues/1157","repository_url":"https://api.github.com/repos/p4lang/p4c","labels_url":"https://api.github.com/repos/p4lang/p4c/issues/1157/labels{/name}","comments_url":"https://api.github.com/repos/p4lang/p4c/issues/1157/comments","events_url":"https://api.github.com/repos/p4lang/p4c/issues/1157/events","html_url":"https://github.com/p4lang/p4c/issues/1157","id":295305458,"number":1157,"title":"Question: Is preserving typedef type aliases on table key fields, action parameters, etc. reasonable to implement?","user":{"login":"jafingerhut","id":109629,"avatar_url":"https://avatars2.githubusercontent.com/u/109629?v=4","gravatar_id":"","url":"https://api.github.com/users/jafingerhut","html_url":"https://github.com/jafingerhut","followers_url":"https://api.github.com/users/jafingerhut/followers","following_url":"https://api.github.com/users/jafingerhut/following{/other_user}","gists_url":"https://api.github.com/users/jafingerhut/gists{/gist_id}","starred_url":"https://api.github.com/users/jafingerhut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jafingerhut/subscriptions","organizations_url":"https://api.github.com/users/jafingerhut/orgs","repos_url":"https://api.github.com/users/jafingerhut/repos","events_url":"https://api.github.com/users/jafingerhut/events{/privacy}","received_events_url":"https://api.github.com/users/jafingerhut/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-07T21:49:54Z","updated_at":"2018-02-08T19:06:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"In a few contexts when developing PSA, and now also in the P4 Runtime API working group, the observation has been made that it would be nice if an annotation could be placed on a typedef, e.g.:\r\n\r\n```\r\ntypedef bit<13> PortId_t;\r\n```\r\n(Please mentally add one or more P4_16 annotations to the code above wherever they are syntactically legal -- I am being lazy and not looking that up right now.)\r\n\r\nThen, wherever that type is used, e.g. for a field in a table's search key, or an action parameter, etc. the typedef name could be associated with it, and preserved in places like the P4Runtime Info file the compiler produces, and the P4 Runtime consumes.\r\n\r\nMy understanding is that right now, p4c treats typedefs as aliases for the underlying type, `bit<13>` in the example above, and it \"forgets\" the PortId_t type.\r\n\r\nIs this \"merely a convenience\" for implementing the p4c compiler?  Something that in order to change, would require a change to the P4_16 language spec (and then the p4c implementation)?  Something else?"},"comment":{"url":"https://api.github.com/repos/p4lang/p4c/issues/comments/364215558","html_url":"https://github.com/p4lang/p4c/issues/1157#issuecomment-364215558","issue_url":"https://api.github.com/repos/p4lang/p4c/issues/1157","id":364215558,"user":{"login":"mbudiu-vmw","id":19397042,"avatar_url":"https://avatars1.githubusercontent.com/u/19397042?v=4","gravatar_id":"","url":"https://api.github.com/users/mbudiu-vmw","html_url":"https://github.com/mbudiu-vmw","followers_url":"https://api.github.com/users/mbudiu-vmw/followers","following_url":"https://api.github.com/users/mbudiu-vmw/following{/other_user}","gists_url":"https://api.github.com/users/mbudiu-vmw/gists{/gist_id}","starred_url":"https://api.github.com/users/mbudiu-vmw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbudiu-vmw/subscriptions","organizations_url":"https://api.github.com/users/mbudiu-vmw/orgs","repos_url":"https://api.github.com/users/mbudiu-vmw/repos","events_url":"https://api.github.com/users/mbudiu-vmw/events{/privacy}","received_events_url":"https://api.github.com/users/mbudiu-vmw/received_events","type":"User","site_admin":false},"created_at":"2018-02-08T19:06:20Z","updated_at":"2018-02-08T19:06:20Z","author_association":"COLLABORATOR","body":"You should not need to add a new type hint, the name you use for the type `mac_addr_t` should be sufficient to describe the type and bind it to other uses -- e.g. in the control-plane."}}
{"actor":{"display_login":"mbudiu-vmw"}}