[racket] CoreMIDI bindings

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Jul 21 17:02:12 EDT 2010

Parameterized modules are called 'units' and it's a different ball game. Yes, something like this is doable. In this world, you can write 

 (define (f some-unit-module)
    ...  (connect a b c) ... ) 

and connect comes from the 'unit module' you pass in. -- Matthias





On Jul 21, 2010, at 4:43 PM, Evan Hanson wrote:

> Makes sense. That's nice flexibility for module users.
> 
> Out of curiosity, how dynamic are module names? Can they be
> manipulated? Say you had two modules that each provide a function
> "connect". You would load them as mod1:connect and mod2:connect using
> prefix-in -- how might one design a form that would associate a call
> to connect inside a passed expression to a given module?
> 
> (define (within-module module-name fun)
>  (module-associate module-name fun) ... )
> 
> (within-module mod1:
>  (lambda (...)
>    (connect arg arg arg) ... )) ; --> equates to (mod1:connect ...)
> 
> This is miles from how it would work, I'm sure, but is it possible?
> 
> Evan
> 
> On Wed, Jul 21, 2010 at 2:45 PM, Todd O'Bryan <toddobryan at gmail.com> wrote:
>>> On Jul 21, 2010, at 2:51 PM, Evan Hanson wrote:
>>> 
>>> Also, is this the kind of thing that should be namespaced? In
>>> contrast to other languages where namespacing is used heavily
>>> (sometimes even to a fault), it seems that many scheme libraries
>>> are quite flat. Is this simply left up to the user to manage, or does
>>> the module system take care of this, or is there something else
>>> I'm missing altogether? Forgive the naïveté if this should be clear to
>> 
>> One way that name collisions get avoided is the
>> 
>> (require (prefix-in pre: "imported-module.rkt"))
>> 
>> form. Every name in the module is prefixed with pre: when you use it
>> in your module, so if you have any name collisions or want to remind
>> yourself where something came from, you just give the module an
>> appropriate prefix when you import it in.
>> 
>> Todd
>> 
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.