Re: [racket-users] Idiomatic Racket approach for handling collisions in library provides?

2017-11-08 Thread Matthias Felleisen

> On Nov 8, 2017, at 7:33 PM, Stuart Hungerford  
> wrote:
> 
> Hi,
> 
> A newbie question about idiomatic Racket code: 
> 
> Suppose I wanted to create several numeric modules that all had their own 
> interpretation of what addition means.  If each of them uses a (provide ... + 
> ...) form, the various "+" exports are going to collide in client modules 
> that (require ...) more than one of them.
> 
> Is it idiomatic Racket usage to prefix the individual "+" functions inside 
> each module like the built-in floating point  modules do (e.g. "fl+") or to 
> assume client modules will use something like (require (rename-in ...)...) or 
> (require (prefix-in ...) ...) to handle any collisions themselves?
> 
> If anyone can point me to example Racket code where this issue has been 
> idiomatically handled that would be very useful.
> 
> This is also a good opportunity to say how impressive the level of 
> documentation and support is in the Racket community. Thanks!
> 
> Stu


prefix-in is the proper way to go if I understand your problem correctly. 
No creator of a ‘server’ module can know all possible names that people
will use to prefix +. fl is good for Felleisen, why not use it to export 
string-append as fl+. 

A client module has complete control over mixing up things. 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Idiomatic Racket approach for handling collisions in library provides?

2017-11-08 Thread Stuart Hungerford
Hi,

A newbie question about idiomatic Racket code: 

Suppose I wanted to create several numeric modules that all had their own 
interpretation of what addition means.  If each of them uses a (provide ... 
+ ...) form, the various "+" exports are going to collide in client modules 
that (require ...) more than one of them.

Is it idiomatic Racket usage to prefix the individual "+" functions inside 
each module like the built-in floating point  modules do (e.g. "fl+") or to 
assume client modules will use something like (require (rename-in ...)...) 
or (require (prefix-in ...) ...) to handle any collisions themselves?

If anyone can point me to example Racket code where this issue has been 
idiomatically handled that would be very useful.

This is also a good opportunity to say how impressive the level of 
documentation and support is in the Racket community. Thanks!

Stu


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.