On Sat, Apr 25, 2020 at 2:25 PM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote:
 
How far is the latter from replacing `:bar' by a variable `bar' that
evaluates to the keyword object named `:bar' under the assumption that
the compiler can infer the value of the variable?

If it can, well and good.  But it can't always: (let ((bar (read)) (foo 10 bar 20)) is an obvious counterexample.  Type analysis is one thing: dataflow analysis is quite another matter.
 
The Racket/Kawa model has the advantage that the call can use a
special protocol even if the callee is not known

 Section 4 of <https://www.cs.utah.edu/plt/publications/scheme09-fb.pdf> describes how keywords are implemented in Racket.  It depends on two things: the #%app macro, which all function calls are rewritten into, and the special case of keywords.




John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
A few times, I did some exuberant stomping about, like a hippo auditioning
for Riverdance, though I stopped when I thought I heard something at
the far side of the room falling over in rhythm with my feet.  --Joseph Zitt