Like, SML’s module system looks nice on paper, but I’ve worked with it in anger (at UChicago) and hated it.
-
-
I understand what they’re trying to do, but the usability is pretty bad. More work is needed.
1 reply 0 retweets 0 likes -
I feel like the issue is using SML, an explicitly academic language - OCaml's module system is far nicer, ime.
1 reply 0 retweets 0 likes -
Replying to @strega_nil @pcwalton and
SML isn't attempting to make modules very ergonomic, but OCaml has done a ton of work in that area
1 reply 0 retweets 0 likes -
Replying to @strega_nil @pcwalton and
I, for example, really appreciate doing stuff like: ``` val reduce : 'a array -> (module Monoid with type t = 'a) -> 'a ```
1 reply 0 retweets 1 like -
I don’t find that kind of thing readable at all, but reasonable people can disagree
1 reply 0 retweets 1 like -
what's not readable about that? genuinely curious.
2 replies 0 retweets 0 likes -
Replying to @strega_nil @pcwalton and
(besides the backwards type application and a bit too much wordiness)
1 reply 0 retweets 0 likes -
Because thinking about a module as a type is weird. By contrast, Rust: fn reduce<A, F>(&[A], F) -> A where F: Monoid<T = A> Or even better, the actual signature, which says what it *is*: fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B
2 replies 0 retweets 0 likes -
I think this is more due to your familiarity than the actual readability of the code -- the code in OCaml gives a lot more semantic clarity, imo, and passing modules as values is not especially weird (it's common in C++ or Haskell, the latter through typeclasses)
2 replies 0 retweets 2 likes
I don’t expect to convince you.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.