[racket] Generics and modules
On Wed, Aug 28, 2013 at 5:07 AM, Tobias Hammer <tobias.hammer at dlr.de> wrote:
> On Tue, 27 Aug 2013 20:03:43 +0200, Greg Hendershott
> <greghendershott at gmail.com> wrote:
>
> . is only special when surrounded by spaces abc.def is a perfectly valid
> variable name (as is abc. and .abc).
Oh, wow. Very early on learning Scheme, I somehow got the idea that
`.` was special in the same way as `,`. Thanks for correcting that!
> Attaching a prop:procedure would be sufficient and only impacts the struct
> access itself, not every statement.
You're right, it's sufficient if you only want it to work when the
dict is in the first position:
(a-dict key)
But alas I also want it to work in the second position:
(key a-dict)
Because only that composes with the threading macro -- so that this:
(~> a-dict k0 k1 k2)
Expands to this:
(k2 (k1 (k0 a-dict)))
And is `#%app`lied as this:
(dict-ref (dict-ref (dict-ref a-dict k0) k1) k2)
As explained here:
https://github.com/greghendershott/rackjure#lang-rackjure