<Armael>
I'm not sure that it raises controversial points: yes, you need C code to do stuff that OCaml cannot do, yes you can break safety that way, but that's the same for the C code from the stdlib
<Armael>
(it's also not clear what one would gain from having lwt in the stdlib)
amiloradovsky has quit [Ping timeout: 240 seconds]
tane has quit [Quit: Leaving]
sagax has quit [Read error: Connection reset by peer]
sagax has joined #ocaml
ollehar2 has joined #ocaml
<ollehar2>
Correct me if i'm wrong, but it's not possible to make a functor without creating a module inside a module?
<ollehar2>
because there's no way to write an mli file to tell it to accept a module?
<ollehar2>
And the idiomatic way is to make a "Make" module? Like in Set,Make(Foo)?
<Armael>
yes
<Leonidas>
Armael: I was thinking it would be fun, since it is full of questions that are all sorta answered by "mu".
<Leonidas>
it is somewhat of a strange python-centric POV to put things in the stdlib
<Leonidas>
which hasn't ever even worked for them since the stdlib is where things go to die.
mfp has joined #ocaml
<Armael>
ah :)
<Armael>
oh, is that so @ python's stdlib? I didn't know that
<ollehar2>
mu?
<ollehar2>
@armael thanks
hlisp has joined #ocaml
nullcone has quit [Quit: Connection closed for inactivity]
hlisp has quit [Ping timeout: 246 seconds]
<notnotdan>
Armael | (it's also not clear what one would gain from having lwt in the stdlib)
<notnotdan>
I guess there are the same advantages as having a modern stdlib in general
<notnotdan>
instead of having several competing "standard" libraries
mbuf has joined #ocaml
<ollehar2>
So why aren't all modules in OCaml functors?
<ollehar2>
If you want to "code to an interface, not an implementation", you always need a functor to inject your dependencies.
<simpson>
We could imagine that unparameterized modules are like functors which take no arguments. (There is a technical and formal way to put this.)
<ollehar2>
Yeah, but why is that the default?
<simpson>
Historical perspectives, probably. These days, some systems *do* have this sort of thinking. The last module system I worked on had zero-or-more imports, and one export, and so every module is like a functor in that system. Curiously, the word "functor" isn't used there!
<ollehar2>
Hm, which system is that? Academic?
<ollehar2>
So there's no global scope, or no "import without interface"?
<simpson>
I'm thinking of Monte, as usual. Indeed there's no global scope. Racket and Newspeak (in addition to OCaml, of course!) are all good languages to look at for this sort of thing. Here's an example from a recent module: https://github.com/monte-language/typhon/blob/master/mast/games/sdf.mt#L1-L8
<ollehar2>
"as usual"? :D
<theblatte>
ollehar2: mostly it gets incredibly verbose if you functorise everything, and very hard to understand which code ends up being called in the functor spaghetti.
<ollehar2>
yeah, but your language is supposed to make that easy for you :)
<theblatte>
if your functor is only ever instantiated with the one module then I prefer for it not to be a functor
<theblatte>
but yeah, basically a style issue at that point
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 265 seconds]
<ollehar2>
Well, also a case about making your dependencies explicit to increase testability, but yeah.
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 256 seconds]
<ollehar2>
that's right, i'll go agile on yo asses
<ollehar2>
someone call uncle bob
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 260 seconds]
rowbee is now known as robi
oturtle has quit [Ping timeout: 260 seconds]
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 246 seconds]
oturtle has joined #ocaml
ollehar2 has quit [Quit: Connection closed]
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 256 seconds]
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 260 seconds]
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 260 seconds]
tane has joined #ocaml
jao has joined #ocaml
hlisp has joined #ocaml
hlisp has quit [Ping timeout: 260 seconds]
ollehar2 has joined #ocaml
<ollehar2>
what's the name of the sig exported by an mli file?
<ollehar2>
like, common.mli --> Common is available as sig?
<Armael>
you don't get a signature, just a module with the signature as written in common.mli
<Armael>
a module with its signature being what's written in common.mli *
<ollehar2>
ok, so I can never use a signature from an implicit module?
<Armael>
you can use "module type of Common" if you need to
<ollehar2>
as argument to a functor?
<ollehar2>
ok, and then I have to do `Common.COMMON`
<ollehar2>
fuck sake
<Armael>
what
<Armael>
functors take modules as arguments, not signatures
<Armael>
unless you are writing the type of a functor?
<ollehar2>
module Make (Common : Common.COMMON) = ...
<Armael>
you can look at how Set or Map from the stdlib do it
<ollehar2>
yeah
<ollehar2>
github can't search by filename. sigh.
<ollehar2>
nvm, easy to find
<ollehar2>
ok, so they define the internal module type as S
<ollehar2>
module make (Common : Common.S) ?
<ollehar2>
Common.C?
<ollehar2>
map.ml also uses S, so `t` for module type, and `S` for module sig. got it.
<ollehar2>
are module sigs not nominal? how come String automatically implements OrderedType?
<ollehar2>
is it cast?
hlisp has joined #ocaml
<Armael>
module sigs are indeed not nominal
<ollehar2>
that's backwards?
ygrek has joined #ocaml
<ollehar2>
if a module has type t and a function compare : t -> t -> int, it is *assumed* it's an OrderedType?
<Armael>
no
<ollehar2>
It should be the other way around, no? String should *tell* the environment by name, not structure, that it is OrderedType?
<Armael>
it's just that if you give it to a functor that requires an OrderedType
<theblatte>
it's structural typing, not nominal
<Armael>
then the typesystem will check that the signature of your module includes OrderedType
<ollehar2>
ok, I thought objects were the only structural types in OCaml.
<Armael>
that's structural typing at the module level, not at the level of types
<ollehar2>
same thing, it's interfaces "with extra steps" :)
<Armael>
*shrug*
<ollehar2>
what if I have a compare function that's not ordered type compliant? can I prevent it from being used in Map or Set?
<theblatte>
yes, don't name it "compare" :)
<ollehar2>
or don't use type t
hlisp has quit [Ping timeout: 258 seconds]
<ollehar2>
one could argue that nominal typing better communicates intent, but bah
<ollehar2>
structural interface typing could be interesting, I guess.
<ollehar2>
it's like javascript all over again :D
<theblatte>
thatsbait.jpg
<ollehar2>
^^
<ollehar2>
did I mention that "blatte" is a very offensive way to say african american in Swedish?
<theblatte>
no, ouch
<ollehar2>
slightly distracting
<companion_cube>
in french it just means "cockroach" :D
<ollehar2>
hahaha
<theblatte>
yes, not offensive at all :p
<ollehar2>
the right wing populist "angry foreigner" had a channel in swedish before called "arg blatte"
<ollehar2>
youtube channel*
<ollehar2>
sorry, ot
hlisp has joined #ocaml
zolk3ri has quit [Remote host closed the connection]
hlisp has quit [Remote host closed the connection]