adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.07.1 release notes: https://caml.inria.fr/pub/distrib/ocaml-4.07/notes/Changes | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml | Due to ongoing spam, you must register your nickname to talk on the channel
pierpal has joined #ocaml
pierpal has quit [Ping timeout: 245 seconds]
carlosdagos has quit [Ping timeout: 250 seconds]
Haudegen has quit [Remote host closed the connection]
zolk3ri has quit [Remote host closed the connection]
silver has quit [Read error: Connection reset by peer]
xuib has quit [Quit: xuib]
mfp has quit [Ping timeout: 258 seconds]
ziyourenxiang has joined #ocaml
pierpal has joined #ocaml
pierpal has quit [Ping timeout: 258 seconds]
ocabot has joined #ocaml
companion_cube has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has quit [Changing host]
ihavelotsoffries has joined #ocaml
ihavelotsoffries has joined #ocaml
<ihavelotsoffries> Hello
ihavelotsoffries has quit [Remote host closed the connection]
ihavelotsoffries has joined #ocaml
ihavelotsoffries has quit [Changing host]
ihavelotsoffries has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has quit [Remote host closed the connection]
<oni-on-ion> hi
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 245 seconds]
gravicappa has joined #ocaml
pierpal has joined #ocaml
pierpal has quit [Read error: Connection reset by peer]
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
Birdface has joined #ocaml
ygrek has quit [Ping timeout: 268 seconds]
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
_whitelogger has joined #ocaml
tg has quit [Ping timeout: 245 seconds]
tg has joined #ocaml
kakadu has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has joined #ocaml
ihavelotsoffries has quit [Changing host]
<ihavelotsoffries> Is this the right place to ask questions about dune?
oni-on-ion has quit [Remote host closed the connection]
oni-on-ion has joined #ocaml
<ihavelotsoffries> oni-on-ion Hello!
<ihavelotsoffries> sorry I got disconnected.
<def`> yes it is the right place
<ihavelotsoffries> def` the right place ;)
<oni-on-ion> hi, its ok ive been d/c-ing myself
<ihavelotsoffries> And when I try to build the project with dune, I get: "Error: Unbound value Obj.magic"
<ihavelotsoffries> and it happens in the parser generated by menhir.
<ihavelotsoffries> On top level, I can look at "Obj.magic" and it seems to be there, obviously.
<ihavelotsoffries> Even more, merlin can find it, using the .merlin file generated by dune itself.
<oni-on-ion> may need preprocess ?
<ihavelotsoffries> hmmm, let me check.
<ihavelotsoffries> I don't think so, you don
<ihavelotsoffries> ...'t need a ppx to use Obj.
<oni-on-ion> dune needs the same info that toplevel (utop? findlib?) and merlin have
<ihavelotsoffries> well, dune uses ocamlfind if it is installed.
<def`> ihavelotsoffries: do you have a module named Obj?
<ihavelotsoffries> okay, here is a simple one: can't compile `let _ = Obj.magic "no-magic"` with dune.
<ihavelotsoffries> probs not. I will search.
<ihavelotsoffries> OMG.
<ihavelotsoffries> Aren't I a dummy?
<ihavelotsoffries> Thank you so much def`!
<def`> np :)
<ihavelotsoffries> Thank you! thank you thank you.
<ihavelotsoffries> I have been banging my head over this one for a bit now!
<ihavelotsoffries> and viola! my parser compiles and runs!
<ihavelotsoffries> For future reference, how can I interrogate to display what module it finds?
<def`> What do you mean?
<ihavelotsoffries> I want to know what dune finds for say pkg `X`, as in give me the path to this module.
<def`> hmm, that's not a direct answer to your question but
<def`> `ocamlfind query X` will give you the folder where the contents of the package is stored
<ihavelotsoffries> cool, thanks!
<def`> all cmi files is this folder will be modules visible from OCaml
<def`> in this folder*
<ihavelotsoffries> I see, cmi being ocaml IR files?
<ihavelotsoffries> sort of like LLVM IR?
<def`> more or less, it is a bit different.
<def`> cmi files are "interface files", they contain what the typechecker needs to know about a module, but nothing about implementation.
<def`> (a kind of compiler ".h" if you compare to C)
<ihavelotsoffries> Okay, I will read up on them more.
<ihavelotsoffries> Time for more coding for me!
<ihavelotsoffries> Thank you :)
<def`> there are some explanation in https://dev.realworldocaml.org/compiler-frontend.html
<def`> but you should probably focus on learning the language first (rather than how the implementation works :P)
<ihavelotsoffries> Getting there, about to finish chapter 2 now :)
<ihavelotsoffries> talk later!
ihavelotsoffries has quit [Remote host closed the connection]
_whitelogger has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
Niamkik has joined #ocaml
oni-on-ion has joined #ocaml
zv has quit [Ping timeout: 258 seconds]
_whitelogger has joined #ocaml
mfp has joined #ocaml
jnavila has joined #ocaml
Haudegen has joined #ocaml
<amosbird> heh, llpp generates suspicious warning: freetype getting character advance: invalid argument
<amosbird> what's the right way to test if a string is empty?
<Armael> yourstring <> "" ?
<Armael> uh sorry, yourstring = ""
<amosbird> thanks
bacam has quit [Quit: reboot]
silver has joined #ocaml
bacam has joined #ocaml
oni-on-ion has quit [Remote host closed the connection]
zolk3ri has joined #ocaml
silver has quit [Read error: Connection reset by peer]
keep_learning_M has quit [Quit: This computer has gone to sleep]
keep_learning_M has joined #ocaml
<amosbird> hmm, what's wrong with this? begin match self#elemunder @@ Printf.sprintf "%d" c with
dstolfa_ has joined #ocaml
dstolfa has quit [Ping timeout: 245 seconds]
<def`> ?
<def`> I can't say anything without more context
ggole has joined #ocaml
<amosbird> I need to convert '1' to 1
<def`> int_of_string
<amosbird> even if that is a char?
<ggole> let int_of_decimal_char = function | '0'..'9' as char -> Char.code char - Char.code '0' | _ -> invalid_arg "non-decimal character"
<amosbird> thanks
<amosbird> hmm, does ocaml have negative index?
<amosbird> [-1] for accessing the last element of a list
<ggole> No.
<amosbird> so what's the right way to index a list reversely? m_items.(active)
<def`> it seems you are manipulating an array, not a list (they are very different things in ML).
<def`> m_items.(Array.length m_items - 1)
<amosbird> oh
<amosbird> thanks
<amosbird> why is this wrong ? method exit2 _ _ = None
<def`> You have to say where 'c is bound / quantified.
<def`> method exit2 : 'a 'b 'c. 'a -> 'b -> 'c option
<def`> this should be ok
<amosbird> hmm, I don't follow
<amosbird> the declaration is method exit2 : cancel:bool -> active:int -> uioh option
<amosbird> I need to provide a default implementation that always returns a None
<def`> try `method exit2 ~cancel:_ ~active:_ = None`
<amosbird> The method exit2 has type cancel:'a -> active:'b -> 'c option where 'c
<amosbird> is unbound
ygrek has joined #ocaml
<octachron> if you are defining the method independently of the declaration/class type/virtual class, you need to add an explicit type annotation to exit2
<amosbird> octachron: hmm, how can I do that?
<amosbird> how can I return a Config.uioh option instead of 'a option?
<amosbird> is None typable?
AtumT has joined #ocaml
<ggole> Add an annotation, eg, method x y : return_type = None
<ggole> You might want annotations on the arguments as well.
<amosbird> method exit2 ~cancel:_ ~active:_ : uioh option = None
<amosbird> The method exit2 has type cancel:'a -> active:'b -> Config.uioh option
<amosbird> where 'b is unbound
<amosbird> ...
<amosbird> very confused
<ggole> If you have free type variables in a class, you are going to have that problem. You can either make them polymorphic as def` suggested, or get rid of them with annotations.
<amosbird> ggole: well I tried both your suggestion with annotations and def` 's
<amosbird> neither works.
<amosbird> it's pretty simple code though https://la.wentropy.com/Izkn
<def`> Add a type annotation on the class, e.g. `class virtual lvsourcebase : lvsource = ...`
<def`> Otherwise there is no relation between lvsourcebase and lvsource
<amosbird> def`: but that requires the class to have all methods defined
<ggole> method exit2 ~cancel:(_ : bool) ~active:(_ : int) : uioh option = None
<ggole> (And the same thing for the other errors which will pop up.)
<amosbird> thanks that works
<amosbird> hmm, overriden isn't allowed in ocaml?
<amosbird> Error (warning 7): the method hasaction2 is overridden.
<def`> It is a warning.
<def`> Put a bang after method to silence it
<octachron> Another option is to define lvsource as a virtual class (with all methods virtual) then inherit lvsource in lvsourcebase
<def`> ^^ that
<amosbird> I've defined another virtual class...
<amosbird> anyway it works out
<amosbird> thank you!
<amosbird> def`: putting that bang in where exactly?
dhil has joined #ocaml
<octachron> method!
<amosbird> Error: The method `hasaction2' has no previous definition
<ggole> You only use method! for overriding
<amosbird> oh
<amosbird> I see
<amosbird> thanks
dhil has quit [Ping timeout: 250 seconds]
<amosbird> hmm, this dbus binding is very old https://github.com/vincenthz/ocaml-dbus
<amosbird> is it the right one to use?
<amosbird> what's the recommended package to talk to dbus using ocaml?
<Armael> there's obus (https://github.com/diml/obus, "obus" on opam)
Facebird has joined #ocaml
Birdface has quit [Ping timeout: 264 seconds]
<amosbird> why does ocamlopt need a -linkpkg flag?
ygrek has quit [Ping timeout: 245 seconds]
xuib has joined #ocaml
AnAverageHuman has joined #ocaml
ziyourenxiang has quit [Ping timeout: 245 seconds]
troydm has quit [Quit: What is Hope? That all of your wishes and all of your dreams come true? To turn back time because things were not supposed to happen like that (C) Rau Le Creuset]
dimitarvp has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
zv has joined #ocaml
dimitarvp has quit [Quit: Bye]
AnAverageHuman has joined #ocaml
Haudegen has quit [Remote host closed the connection]
gravicappa has quit [Ping timeout: 245 seconds]
troydm has joined #ocaml
gravicappa has joined #ocaml
Jeanne-Kamikaze has joined #ocaml
jnavila has quit [Ping timeout: 276 seconds]
Guest87353 has joined #ocaml
Guest87353 has quit [Read error: Connection reset by peer]
zolk3ri has quit [Remote host closed the connection]
jao has joined #ocaml
silver has joined #ocaml
ggole has quit [Quit: Leaving]
gravicappa has quit [Ping timeout: 250 seconds]
TheRuralJuror has joined #ocaml
Jeanne-Kamikaze has quit [Quit: Leaving]
TheRuralJuror has quit [Remote host closed the connection]
Haudegen has joined #ocaml
Keodedad has joined #ocaml
Keodedad has quit [Client Quit]
AnAverageHuman has quit [Ping timeout: 256 seconds]
AnAverageHuman has joined #ocaml
AnAverageHuman has quit [Ping timeout: 256 seconds]
Jesin has quit [Quit: Leaving]
Jesin has joined #ocaml
Facebird has quit [Ping timeout: 250 seconds]
kakadu has quit [Remote host closed the connection]
ziyourenxiang has joined #ocaml
Haudegen has quit [Remote host closed the connection]
zv has quit [Ping timeout: 264 seconds]
oni-on-ion has joined #ocaml
zv has joined #ocaml
weird_error has quit [Quit: weird_error]