{"action":"created","issue":{"url":"https://api.github.com/repos/racket/racket/issues/956","labels_url":"https://api.github.com/repos/racket/racket/issues/956/labels{/name}","comments_url":"https://api.github.com/repos/racket/racket/issues/956/comments","events_url":"https://api.github.com/repos/racket/racket/issues/956/events","html_url":"https://github.com/racket/racket/pull/956","id":85563477,"number":956,"title":"Generalize inferred names","user":{"login":"gus-massa","id":1566656,"avatar_url":"https://avatars.githubusercontent.com/u/1566656?v=3","gravatar_id":"","url":"https://api.github.com/users/gus-massa","html_url":"https://github.com/gus-massa","followers_url":"https://api.github.com/users/gus-massa/followers","following_url":"https://api.github.com/users/gus-massa/following{/other_user}","gists_url":"https://api.github.com/users/gus-massa/gists{/gist_id}","starred_url":"https://api.github.com/users/gus-massa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gus-massa/subscriptions","organizations_url":"https://api.github.com/users/gus-massa/orgs","repos_url":"https://api.github.com/users/gus-massa/repos","events_url":"https://api.github.com/users/gus-massa/events{/privacy}","received_events_url":"https://api.github.com/users/gus-massa/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-06-05T15:46:00Z","updated_at":"2015-10-05T18:02:45Z","closed_at":"2015-10-05T18:02:45Z","pull_request":{"url":"https://api.github.com/repos/racket/racket/pulls/956","html_url":"https://github.com/racket/racket/pull/956","diff_url":"https://github.com/racket/racket/pull/956.diff","patch_url":"https://github.com/racket/racket/pull/956.patch"},"body":"After some expansions, a expression with the syntax property `'inferred-name` of\r\n`'x` is converted to one with ` ('x . 'x) `, so it's not useful to get the name of a\r\nprocedure. \r\n\r\nSo we simplify the syntax property `'inferred-name` to handle\r\nthese cases, to trees deep <=5, where all the leaves are the same symbol. (In the wild, I only saw the 1-level case ` ('x . 'x) `).\r\n\r\nThe same simplification is useful for properties like ` (#<void> . #<void>)` that are simplified to `#<void>` and replace the local inferred name with the location.\r\n\r\nThis commit also changes `syntax-local-infer-name` in the case that the property is not a symbol. This is a small breaking change, but the new behavior is more consistent with the names of the procedures.\r\n\r\nSome examples:\r\n\r\n    #lang racket\r\n\r\n    (define-syntax (thunk1 stx)\r\n      (syntax-case stx ()\r\n        [(_ v)\r\n         (begin\r\n           #;(displayln (eval #'v))\r\n           (syntax-property\r\n            #'(lambda () 1)\r\n            'inferred-name\r\n            (eval #'v)))]))\r\n\r\n\r\n     (let ([tmp (thunk1 (cons 'one 'one))]) tmp)     ;==> #<procedure:tmp> \r\n                                                          ;changes to #<procedure:one>\r\n     (let ([tmp (thunk1 (cons 1 1))]) tmp)           ;==> #<procedure:tmp>\r\n     (let ([tmp (thunk1 (cons (void) (void)))]) tmp) ;==> #<procedure:tmp> \r\n                                                          ;changes to #<procedure:test.rkt:77:77>\r\n     (let ([tmp (thunk1 (cons #f #f))]) tmp)         ;==> #<procedure:tmp>\r\n     (let ([tmp (thunk1 (cons \"one\" \"one\"))]) tmp)   ;==> #<procedure:tmp>\r\n\r\nTODO:\r\n* Fix the documentation of `'inferred-name` and `syntax-local-infer-name`\r\n* Add tests. (I'm not sure where I should to put them)\r\n"},"comment":{"url":"https://api.github.com/repos/racket/racket/issues/comments/145615696","html_url":"https://github.com/racket/racket/pull/956#issuecomment-145615696","issue_url":"https://api.github.com/repos/racket/racket/issues/956","id":145615696,"user":{"login":"mflatt","id":295034,"avatar_url":"https://avatars.githubusercontent.com/u/295034?v=3","gravatar_id":"","url":"https://api.github.com/users/mflatt","html_url":"https://github.com/mflatt","followers_url":"https://api.github.com/users/mflatt/followers","following_url":"https://api.github.com/users/mflatt/following{/other_user}","gists_url":"https://api.github.com/users/mflatt/gists{/gist_id}","starred_url":"https://api.github.com/users/mflatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mflatt/subscriptions","organizations_url":"https://api.github.com/users/mflatt/orgs","repos_url":"https://api.github.com/users/mflatt/repos","events_url":"https://api.github.com/users/mflatt/events{/privacy}","received_events_url":"https://api.github.com/users/mflatt/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T18:02:45Z","updated_at":"2015-10-05T18:02:45Z","body":"merged"}}