[racket-dev] syntax-local-inferred-name, keyword functions, and syntax properties

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Mon Dec 9 16:41:41 EST 2013

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
<robby at 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 <samth at 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
>> <samth at 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
>> > <robby at 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
>> >> <samth at 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
>> >>
>> >>
>
>


Posted on the dev mailing list.