<gasche>
rgrinberg: the dirty truth is that, given that I spend most of my OCaml time these days hacking the OCaml compiler (and playing between many switches), I kind of lost the habit of using Merlin on compiler-related projects
<gasche>
but thanks, it definitely makes sense for ocamlbuild
<xvw_>
Yo, is there a way to add a structure on the begining of a file when i writte a PPX?
copy` has quit [Quit: Connection closed for inactivity]
<rgrinberg>
gasche: I see. I hope one day merlin will work with the compiler out of the box (if it's even possible).
<rgrinberg>
Also, does manual.adoc get rendered somewhere? I'd love to see how it looks
hx0 has quit [Ping timeout: 244 seconds]
<gasche>
rgrinberg: the github repo renders it
<gasche>
(there is a PR in the old manual repository for Makefile rules for rendering but they're a bit complex and I haven't had time to look at them)
<gasche>
I think that indeed Merlin could work on the compiler, but it requires synchronized Merlin and compiler changes, and so far it has not happened
<gasche>
(witness the small delay for 4.03 support)
<gasche>
I think what's really needed is a regular compiler contributor motivated to bugger the Merlin people when it breaks
<gasche>
(and so far I did not have the courage to be that person)
<Algebr```>
what is the proper syntax for this? class type foo ?thing () = object end
xvw_ has quit [Quit: xvw_]
<gasche>
Algebr`` class types do not take arguments
<gasche>
so it would be
<gasche>
class foo ?thing () = object end
<gasche>
class foo_ty = object end
<gasche>
class foo ?thing () : foo_ty = object end
<gasche>
hm
<gasche>
I meant
<gasche>
class type foo_ty = object end
<gasche>
class foo ?thing () : foo_ty = object end
<gasche>
sorry
<Algebr```>
gasche: wait, which one is the right one?
<Algebr```>
ah, you mean explcitly having to do the : in the actual class
<gasche>
you don't actually have to
<gasche>
but I'm just saying, class type don't take arguments, they just classify objects
<Algebr```>
why aren't the arguments taken into account for a class type then?
hx0 has joined #ocaml
<gasche>
it wouldn't really make sense, I think
<mrvn>
arguments to classes don't realy make sense
<Algebr```>
ahhh
<gasche>
I think of a class declaration as "it takes arguments and then returns an object of some class type"
<mrvn>
just syntactic suggar to avoid having to write class types
<mrvn>
gasche: fun x y z -> class foo = object ... end
<Algebr```>
right right.
ollehar has quit [Quit: ollehar]
<Drup>
gasche: merlin works decently on the compiler itself
<Algebr```>
created a class in a module and then did an include on the module, now getting unbound class
<Algebr```>
sigh
hx0 has quit [Ping timeout: 246 seconds]
<Algebr```>
gasche: why do classes have to reveal instance variables in signatures?
hx0 has joined #ocaml
<mrvn>
Algebr```: inheritance?
<Algebr```>
I don't see why inheritance matters here, child will override parent anyway
<Algebr```>
yes! first real usage of recursive modules
<mrvn>
so the child knows what variables are there
<Algebr```>
ahhhh darn
<mrvn>
# class base = object val x = 1 end class foo = object inherit base method foo = x end;;
<mrvn>
class base : object val x : int end
<mrvn>
class foo : object val x : int method foo : int end
<Algebr```>
oh wow, found an actual place where merlin isn't catching a syntax mistake
<Algebr```>
def`:
<Algebr```>
def`: I put it on a branch so can check out later
<Algebr```>
this oasis driven warning is annoying, any way to fix it? Configuration "true: quiet, debug, tests", line 1, characters 20-25: Warning: the tag "tests" is not used in any flag or dependency declaration,
kushal has joined #ocaml
kushal has quit [Read error: Connection reset by peer]
al-damiri has quit [Quit: Connection closed for inactivity]
<Algebr```>
there's no `include moduleSignature` kind of syntax available?
pierpa has quit [Ping timeout: 272 seconds]
uriznik has joined #ocaml
d0nn1e has quit [Ping timeout: 260 seconds]
d0nn1e has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
tmtwd has joined #ocaml
nivek has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
walter|r has quit [Remote host closed the connection]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<struk|desk>
Algebr```: what recursive modules are you speaking of?
<Algebr```>
module rec Foo
<struk|desk>
Algebr```: I mean, what was your "good" use case for it?
pyon has quit [Quit: fix config]
<Algebr```>
record in one module needed type of class in another, vice versa
jonasen has joined #ocaml
clog has quit [Ping timeout: 240 seconds]
pyon has joined #ocaml
<struk|desk>
is it specifically because you're using classes, then?
<Algebr```>
probably since type foo and bar = object end doesn't work
<struk|desk>
yeah
<Algebr```>
actually ended up using 3 modules together recursively
<struk|desk>
exciting! living on the wild side, I see.
<mrvn>
it sucks that you can't have recursive classes or recursive with mixed branches. The recursive module syntax is a pain.
<Algebr```>
incredible pain
<mrvn>
tell more
<struk|desk>
ppx_import could be modded to make it less annoying
<Algebr```>
also using the ability that module sig of only type definitions gets a name of the same of the module
<Algebr```>
thankfully it played nicely with mli, only had to expose 2 of the 3 rec modules in the mli
slash^ has joined #ocaml
<mrvn>
Algebr```: screw that. just include the 2 (3) modules after declaring them to get it all into one namespace
clog has joined #ocaml
<Algebr```>
yea, also played with that too
<Algebr```>
actually turned out as nice as I wanted it to be
<mrvn>
actually, just thinking through it again. How do you write the mli file without the recursive module?
<Algebr```>
I only included 2 of the 3
zRecursive has joined #ocaml
<zRecursive>
What does "Error: Unbound module Foo" mean ?
yunxing_ has joined #ocaml
yunxing_ has quit [Client Quit]
darkf_ has joined #ocaml
darkf__ has joined #ocaml
darkf has quit [Ping timeout: 250 seconds]
kushal has joined #ocaml
Algebr``` has quit [Ping timeout: 250 seconds]
darkf_ has quit [Ping timeout: 250 seconds]
<mrvn>
With the control flow integrity stuff how do I make my compiler work that doesn't use a stack at all?
<mrvn>
ups, ewin
kolko has quit [Ping timeout: 240 seconds]
kushal has quit [Excess Flood]
darkf__ has quit [Ping timeout: 250 seconds]
kushal has joined #ocaml
p_nathan has quit [Quit: Leaving.]
<Enjolras>
zRecursive: it means you are trying to use a module named Foo but no module definition for module Foo is visible in the current scope
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Enjolras>
it is the same error message for values to "unbound" means "no definition has been bound to this name"
<Enjolras>
in other languages it would be something like "but module Foo is undefined"
Algebr``` has joined #ocaml
<struk|desk>
zRecursive: I sometimes do that by stupidly writing this: "module Foo = struct type t let f (t:Foo.t) = ... end "
jonasen has joined #ocaml
kolko has joined #ocaml
Algebr``` has quit [Ping timeout: 250 seconds]
MercurialAlchemi has joined #ocaml
tmtwd has quit [Ping timeout: 272 seconds]
<zRecursive>
thanks all! i need to think it for a while. Because the project works very well under 3.1.2 before.
tmtwd has joined #ocaml
darkf has joined #ocaml
Algebr``` has joined #ocaml
hx0 has quit [Ping timeout: 244 seconds]
tmtwd has quit [Ping timeout: 250 seconds]
Algebr``` has quit [Ping timeout: 250 seconds]
Simn has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 250 seconds]
A1977494 has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
mcc has quit [Quit: Connection closed for inactivity]
A1977494 has quit [Remote host closed the connection]
slash_ has quit [Read error: Connection reset by peer]
adelbertc_ has joined #ocaml
mattg_ has joined #ocaml
mehdib_ has joined #ocaml
bernardo1pc has joined #ocaml
fds_ has joined #ocaml
tormen_ has joined #ocaml
jknick_ has joined #ocaml
sshine has joined #ocaml
Reventlo1 has joined #ocaml
ygrek has quit [Ping timeout: 250 seconds]
nzyuzin_ has joined #ocaml
profan_ has joined #ocaml
troydm has quit [Ping timeout: 244 seconds]
lindas has joined #ocaml
jave_ has joined #ocaml
slash^ has quit [*.net *.split]
jun has quit [*.net *.split]
lyxia has quit [*.net *.split]
sshine_ has quit [*.net *.split]
tg has quit [*.net *.split]
bernardofpc has quit [*.net *.split]
adelbertc has quit [*.net *.split]
Nahra has quit [*.net *.split]
fds has quit [*.net *.split]
tormen has quit [*.net *.split]
chenglou has quit [*.net *.split]
mattg has quit [*.net *.split]
jknick has quit [*.net *.split]
jave has quit [*.net *.split]
Guest31006 has quit [*.net *.split]
Reventlov has quit [*.net *.split]
flux has quit [*.net *.split]
mehdib has quit [*.net *.split]
profan has quit [*.net *.split]
lin has quit [*.net *.split]
nzyuzin has quit [*.net *.split]
chelfi has quit [*.net *.split]
maurer has quit [*.net *.split]
flx is now known as flux
tg` is now known as tg
mattg_ is now known as mattg
troydm has joined #ocaml
chenglou_ is now known as chenglou
adelbertc_ is now known as adelbertc
jun has joined #ocaml
chelfi has joined #ocaml
lyxia has joined #ocaml
maurer has joined #ocaml
Guest31006 has joined #ocaml
Algebr``` has quit [Ping timeout: 250 seconds]
Simn has quit [Read error: Connection reset by peer]
lindas is now known as l1n
l1n is now known as lin
troydm has quit [Ping timeout: 244 seconds]
Kakadu has joined #ocaml
nivek has joined #ocaml
Algebr``` has joined #ocaml
Algebr``` has quit [Ping timeout: 250 seconds]
troydm has joined #ocaml
atbagautdinov has quit [Quit: atbagautdinov]
mettekou has quit [Read error: Connection reset by peer]
<orbitz>
Hello, I have what I think is a common problem. I have a type 'a t that is a record, and there are some values for it which dont' depend on 'a at all, and I'd like to do: let foo = { this = `That } in a type safe way. is that possible? My problem right now, if I understand the error, is that the type of foo doesn't match the type of the function where I am using it.
<orbitz>
I tried let foo 'a. 'a t = { this = `That } but that didn't work
<orbitz>
Effectively I' trying to avoid allocating a struct all the time in a case where it's static
<mrvn>
orbitz: { t with this = `That }?
<mrvn>
or do you want to say that { this = `That } is polymorphic like [] works for any list?
<orbitz>
mrvn: the latter
<orbitz>
Basically I'm caching a common value I'll have to avoid an allocation. And I'm just curious.
<mrvn>
well, first thing: let foo () = { this = `That }, then each invokation allocates a new one wich can be any type.
<mrvn>
the other thing is to declate the record as +'a t
<mrvn>
s/declate/declare/
<orbitz>
THe function thign I want to avoid since I'm trying to avoid the allocation
<orbitz>
what does the + annotation do? I believe it has to do with subtyping?
<mrvn>
orbitz: the you have values that can be any 'a type like [].
<orbitz>
right
<mrvn>
orbitz: can't explain it right but that + is to tell the compiler abvout your issue for cases where it doesn't/can't infer that on its own. Check the docs about it.
<orbitz>
arghh you know what. This is actually a typo on my part!
<orbitz>
The obvious solution works fine, I'm just a bit daft.
<mrvn>
hehe
<orbitz>
of course :)
<orbitz>
thanks mrvn
yunxing_ has joined #ocaml
<mrvn>
we live to serve (as a sounding board)
troydm has quit [Ping timeout: 244 seconds]
wiredsister has quit [Ping timeout: 258 seconds]
yunxing__ has joined #ocaml
troydm has joined #ocaml
<mrvn>
the NSA wants it's root kit to run somewhere
<mrvn>
ups
yunxing_ has quit [Ping timeout: 250 seconds]
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
dhil has quit [Ping timeout: 260 seconds]
octachron has joined #ocaml
MercurialAlchemi has quit [Ping timeout: 264 seconds]
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nivek has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<seliopou>
rgrinberg did you port opium to lwt? :P
yunxing__ has quit [Ping timeout: 250 seconds]
<jnavila>
Hi, how can I use oUnit to test functions inside the body of my module, but without declaring the tested function in the interface of that module ? I'm using oasis and that does not seem to be possible
<mrvn>
can't
<jnavila>
:/
<mrvn>
would be nice to have a "#ifdef enable_testing" for that
Algebr``` has joined #ocaml
<apache2>
isn't there a ppx for doing something like that?
<jnavila>
Yep. In fact, I'm not even sure I'm handling this correctly. To be able to test some functions, I had to move them from the main file of the executable to another and declare a module on it.
<apache2>
that sounds like a good thing
nivek has joined #ocaml
<apache2>
unless you're making something very specific, you generally want to put as much of your functional code in smaller units / "libraries" to allow other tools to use the same functions
<jnavila>
OK. No "best practice" solution, then.
<mrvn>
write tests that use the public api
<jnavila>
Ah, maybe I should to create internal API ;-)
<rgrinberg>
seliopou: a while ago
darkf has joined #ocaml
<apache2>
jnavila: best practice is to have an internal API :)
<mrvn>
I've seen people have all the unit tests as part of the module and just expose a single test function that runs all the internal tests
<jnavila>
Ok, I'll try both approaches, thanks both.
xitrium has joined #ocaml
<Algebr```>
why doesn't include Some_module_sig work in an mli
<Algebr```>
and why can't module types be recursive?
redpoppies has joined #ocaml
jnavila has quit [Quit: Konversation terminated!]
<Algebr```>
def`: and merlin doesn't complain about lower case word in module type foo = sig end
<octachron>
Algebr```, including a module type should work?
<octachron>
Algebr```, lower case word are perfectly valid OCaml for module type
<Algebr```>
what
<Algebr```>
wow
<mrvn>
no cycles allowed except via recursive modules.
<Algebr```>
including a module type does work but I don't want that
pyon is now known as inf-groupoid
<Algebr```>
I want to do an include of a module Foo : sig end
<octachron>
include (module type of Foo) ?
<Algebr```>
!!!!
<Algebr```>
AWESOME!
<Algebr```>
explain explain!!
<Algebr```>
the of keyword being used this way is odd to me
<octachron>
(module type of M) computes the module type of a given module, with few caveat (at least I remember several mantis ticket on this construction)
<Algebr```>
so it makes it on the fly
<octachron>
well, a module type is still a type so fully computed at compilation time
xitrium has left #ocaml [#ocaml]
redpoppies has quit [Ping timeout: 276 seconds]
<mrvn>
but M is a module and you want the type OF M.
xitrium has joined #ocaml
A1977494 has quit [Remote host closed the connection]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
tane has quit [Quit: Leaving]
xitrium has quit []
mettekou has joined #ocaml
kolko has quit [Ping timeout: 244 seconds]
StrykerKKD has joined #ocaml
jlouis__ is now known as jlouis
<struk|desk>
how do you return an array type with ctypes when you don't know the size of the array in advance? eg. foreign "foo" (t @-> returning (array N bool) <-- what if I don't know N.
<mrvn>
C has no arrays, only pointers. return one
<struk|desk>
actually now that you mention it the C++ api I'm wrapping actually returns some special array object (which is as you guessed as pointer), so my question was ill conceived. thanks
<struk|desk>
*is a pointer
<mrvn>
class with pointer and length? Or how do you get the size?
<struk|desk>
it has public methods
<struk|desk>
I am will just wrap it the same way I am wrapping the apis other objects
<mrvn>
I have similar things in Qt5. I always wonder at what point it would make sense to extract all the data and put it into an ocaml type instead of keeping it wraped.
<struk|desk>
thats an interesting..like a runtime meta data thing?
<struk|desk>
I like qt5, actually
dwwoelfel has joined #ocaml
<struk|desk>
IF I had to rewrite that api in c++ I would use qt5 as a base
<mrvn>
Things like a Color. Would make sense to copy it into uint32. Or a Pixmap into an int32 bigarray.
dwwoelfel has quit [Remote host closed the connection]
<mrvn>
struk|desk: I would love to have Qt5 reimplemented using c++15 (std::move, std::shared_ptr, ...)
dwwoelfel has joined #ocaml
<struk|desk>
mrvn: does it makes its containers/strings/streams and whatnot injectable into other libs?
<mrvn>
Qt5? no
<struk|desk>
I mean, a reimplementation as you suggested?
<mrvn>
struk|desk: that would depend on you reimplementing it that way
atbagautdinov has joined #ocaml
<struk|desk>
sure
<struk|desk>
your analogy to Qt5 is kind of dead on, as this thing has its own memory model (smart pts) and various other idioms on top of c++
<struk|desk>
has its own base object, etc. factories to create everyting..
chindy_ has quit [Ping timeout: 244 seconds]
Algebr``` has quit [Ping timeout: 272 seconds]
octachron has quit [Ping timeout: 250 seconds]
copy` has quit [Quit: Connection closed for inactivity]
Guest31006 has quit [Quit: reconnect]
Madars has joined #ocaml
zRecursive has joined #ocaml
mettekou has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
madroach has quit [Ping timeout: 244 seconds]
madroach has joined #ocaml
atbagautdinov has quit [Ping timeout: 244 seconds]
<mrvn>
struk|desk: kind of stupid since the c++ standard has all that now.
zRecursive has left #ocaml ["ERC (IRC client for Emacs 24.5.1)"]
<struk|desk>
mrvn: well that was before such standards existed I hope
<struk|desk>
this api is also meant to mimic java's sdk to some degree, as it's a reimpl of a java api in the first place