Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Hi Matthew, I don't understand why this is the right fix. In particular, the keyword application form still uses the inferred name in a way that doesn't make sense to me. Can you say more? Sam On Sat, Dec 14, 2013 at 11:35 PM, Matthew Flatt mfl...@cs.utah.edu wrote: I've pushed a repair. At Mon, 9 Dec 2013 16:56:49 -0500, Sam Tobin-Hochstadt wrote: On Mon, Dec 9, 2013 at 4:50 PM, Robby Findler ro...@eecs.northwestern.edu wrote: I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. The point I'm trying to make is that I think the error message is _currently bad_, because there's no reason to think of that procedure as named `foo`. We'd be better off and less confused if the procedure in the error message didn't have a name. If you think changing it would be bad, why do you think the relevant procedure (the one with a keyword named `#:kk`) should be named `foo`? Sam Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Sorry --- it looks like I fixed the problem for a similar example, (let ([foo ((lambda (x #:a a) 1) 1 2)]) 5) but not for your examples. I'll try again. At Sun, 15 Dec 2013 14:26:09 -0500, Sam Tobin-Hochstadt wrote: Hi Matthew, I don't understand why this is the right fix. In particular, the keyword application form still uses the inferred name in a way that doesn't make sense to me. Can you say more? Sam On Sat, Dec 14, 2013 at 11:35 PM, Matthew Flatt mfl...@cs.utah.edu wrote: I've pushed a repair. At Mon, 9 Dec 2013 16:56:49 -0500, Sam Tobin-Hochstadt wrote: On Mon, Dec 9, 2013 at 4:50 PM, Robby Findler ro...@eecs.northwestern.edu wrote: I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. The point I'm trying to make is that I think the error message is _currently bad_, because there's no reason to think of that procedure as named `foo`. We'd be better off and less confused if the procedure in the error message didn't have a name. If you think changing it would be bad, why do you think the relevant procedure (the one with a keyword named `#:kk`) should be named `foo`? Sam Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
I've pushed a repair. At Mon, 9 Dec 2013 16:56:49 -0500, Sam Tobin-Hochstadt wrote: On Mon, Dec 9, 2013 at 4:50 PM, Robby Findler ro...@eecs.northwestern.edu wrote: I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. The point I'm trying to make is that I think the error message is _currently bad_, because there's no reason to think of that procedure as named `foo`. We'd be better off and less confused if the procedure in the error message didn't have a name. If you think changing it would be bad, why do you think the relevant procedure (the one with a keyword named `#:kk`) should be named `foo`? Sam Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
[racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.eduwrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Oh, now I get what you meant in your original message. Right. Robby On Mon, Dec 9, 2013 at 3:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.eduwrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.eduwrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
So, you agree that we should just change this? On Mon, Dec 9, 2013 at 4:35 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Oh, now I get what you meant in your original message. Right. Robby On Mon, Dec 9, 2013 at 3:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.eduwrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
On Mon, Dec 9, 2013 at 4:50 PM, Robby Findler ro...@eecs.northwestern.edu wrote: I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. The point I'm trying to make is that I think the error message is _currently bad_, because there's no reason to think of that procedure as named `foo`. We'd be better off and less confused if the procedure in the error message didn't have a name. If you think changing it would be bad, why do you think the relevant procedure (the one with a keyword named `#:kk`) should be named `foo`? Sam Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev
Re: [racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties
You're right. I misread the code. Yes, changing it seems good. Robby On Mon, Dec 9, 2013 at 3:56 PM, Sam Tobin-Hochstadt sa...@cs.indiana.eduwrote: On Mon, Dec 9, 2013 at 4:50 PM, Robby Findler ro...@eecs.northwestern.edu wrote: I'm not really familiar with the way the keyword expansion works. I was just trying to suggest obvious reasons why the code would do such a thing. But if you find that changing the name changes the error message, then changing that would be bad. The point I'm trying to make is that I think the error message is _currently bad_, because there's no reason to think of that procedure as named `foo`. We'd be better off and less confused if the procedure in the error message didn't have a name. If you think changing it would be bad, why do you think the relevant procedure (the one with a keyword named `#:kk`) should be named `foo`? Sam Sorry for the noise. Robby On Mon, Dec 9, 2013 at 3:41 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Yes, that would work, but I still don't see why that's a useful name to use. Sam On Mon, Dec 9, 2013 at 4:37 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Would it work to make it use syntax-local-infer-name but only use the symbolic part of that name? Robby On Mon, Dec 9, 2013 at 3:34 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Aha, I found the example: (let ([foo ((lambda (#:kk x) (λ (x) x)) #:k 0)]) (foo 5)) Has this error: application: procedure does not expect an argument with given keyword procedure: foo given keyword: #:k arguments...: #:k 0 Note that if you make the keywords the same, `foo` is indeed bound to a procedure, but _not_ to the procedure referred to in the error message. Sam On Mon, Dec 9, 2013 at 4:29 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: I haven't found a way to make it happen yet. But even so, it seems like the wrong name. Sam On Mon, Dec 9, 2013 at 4:16 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Is it possible that that name can leak out in an error message? Robby On Mon, Dec 9, 2013 at 3:10 PM, Sam Tobin-Hochstadt sa...@cs.indiana.edu wrote: Currently, this program fails with a somewhat bizarre type error: #lang typed/racket (: foo ([#:k Any] - Integer)) (define (foo #:k [s #f]) 0) (let: ([i : Integer (foo #:k #t)]) i) The reason is that the expansion of keyword applications generates a name to use for the function (here `foo`), and it uses `syntax-local-infer-name` to get the name to use. Unfortunately, in this case, it produces `i`, an identifier which has an extra syntax property saying that `i` is an `Integer`. Of course, `foo` isn't an integer, it's a function, and so we get a type error. I don't see why the inferred name is the right choice here -- there's no connection between `i` and the name of the function. I can just change this to use a fresh name, but I thought I'd ask first. Sam _ Racket Developers list: http://lists.racket-lang.org/dev _ Racket Developers list: http://lists.racket-lang.org/dev