[Haskell-cafe] New type of ($) operator in GHC 8.0 is problematic
Bardur Arantsson
spam at scientician.net
Sat Feb 13 09:41:06 UTC 2016
On 02/13/2016 08:03 AM, Joachim Durchholz wrote:
> Am 13.02.2016 um 07:11 schrieb Rustom Mody:
>> I would have thought that SML would be the one which had the most
>> sophisticated module-sublanguage. Would be interested to know how SML
>> and
>> Java stack up against each other in that respect.
>
> I never understood SML's module system. The explanations I found were
> focused on the "what", and very intricate, but I never found an
> explanation "why" they were doing it. My impression was that it was
> quite sophisticated in its possibilities to adapt a module during
> import, but I was never sure whether SML's notion of module was even
> similar to that in other languages.
>
It's _hugely_ more advanced than most module systems out there. AFAIUI
O'Caml has a similar system, but I'm not sure it's quite that advanced.
Basically it _can_ subsume type classes, but using it for that purpose
is unbelievably verbose and it doesn't get you global coherence.
They also allow you to *cleanly* separate interface from implementation.
(S/O'Ca)ML modules are the one thing I miss about programming in O'Caml
relative to Haskell. (Alright, there are a couple of other minor things,
but we're probably off-topic enough already :))
> The Java module system isn't spectactular, essentially an import
> establishes visibility and nothing more (adaptation is separate, and
> limited to type parameters), and you have a hierarchical namespace.
It's terrible and basically name-space only. What's even stranger is
that it's an *open* namespace (apart from the standard ones, I believe?)
which means that I can retroactively add a class in say,
org.spring.integration
and access package-scope bits of the original org.spring.integration
namespace.
It's a pretty weird system that seems to be driven by Java's
"one-class-per-file" mentality[1].
Disclaimer: Java 9 is getting a new module system, Jigsaw, but I'm not
really too familiar with what it actually does, so I won't comment
beyond this disclaimer :).
> The only thing that sets Java apart is that the DNS namespace is used as
> the basis, and that's not even a language rule, just a recommendation;
> the fascinating thing is that a mere recommendation was enough to make
> clear who's responsible for fixing a name conflict, and virtually
> eliminate name conflicts from the Java world.
Yes, *this* was a FANTASTIC idea and it's soooo simple once you're aware
of it. (No sarcasm intended, btw.)
Unfortunately, the Scala people seem to be tiring of the long names and
are regressing towards just using top-level names like "play" and
"argonaut" and such... :/
> [Please don't mail directly and CC to Haskell-cafe, this defeats my
> mailer's "reply to list" function.]
Apologies if I'm doing this. I'm using the list through GMANE and cannot
help it.
[1] Yes, I'm aware that you can actually have multiple classes in a
file. Almost nobody does that.
Regards,
More information about the Haskell-Cafe
mailing list