[racket-dev] generic API names considered harmful

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Sun Jul 6 22:15:22 EDT 2014

 What about 3rd party modules?

For example, should  http://planet.racket-lang.org/package-source/dherman/syntactic-closures.plt/1/0/syntactic-closures.ss  provide
syntactic-closures-compile, syntactic-closures-execute and syntactic-closures-scheme-syntactic-environment ?

Collections may be renamed. Eventually collection names will become longer, because they have to be unique (like in java: org.apache.commons.lang.builder.ToStringBuilder). Besides we have modules and prefix-in.

Even in Common Lisp, Google propose omit prefixes in names:  http://google-styleguide.googlecode.com/svn/trunk/lispguide.xml?showone=Omit_library_prefixes#Omit_library_prefixes  I propose the same: every module should provide only short names without prefixes.
Modules like `racket' should re-export the names with approptiate prefixes. Something-like

syntax/bound-id-table.rkt
(provide ref set set! remove ...)

syntax/id-table.rkt
(require (prefix-in bound-id-table- "bound-id-table.rkt"))
(provide bound-id-table-ref bound-id-table-set ...)

Fri, 04 Jul 2014 19:30:44 -0400 от Neil Van Dyke <neil at neilvandyke.org>:
>For documented public API of modules that are part of core Racket, 
>shouldn't pretty much all the identifiers be descriptive enough to be 
>unique within the scope of core Racket?  (Excepting name conflicts from 
>SRFIs and teaching languages?)
>
>I've now noticed generic API names like "make" and "render" in core 
>Racket modules written by, I think, 3 different very smart core Racket 
>developers.  I don't understand why we're still doing this. Was it for 
>use with the units&signatures (which are more trouble than they're 
>worth, IMHO)?
>
>For code using these APIs, for readability (since any generic names in a 
>module are relative to what that module is about, not the possibly many 
>modules that module uses), I end up using "prefix-in" on modules with 
>generic API names, which is still harder to read than natural identifiers.
>
>And even if I do the "prefix-in" like "foo-lib:", with a colon on the 
>end, "foo-lib:make" is still harder for someone reading the code to look 
>up the identifier in Racket doc search, compared looking up a unique API 
>identifier like "make-foo" or "foo-make".
>
>Neil V.
>
>_________________________
>  Racket Developers list:
>   http://lists.racket-lang.org/dev


-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20140707/552db55f/attachment.html>

Posted on the dev mailing list.