adrien changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml MOOC http://1149.fr/ocaml-mooc | OCaml 4.02.3 announced http://ocaml.org/releases/4.02.html | Try OCaml in your browser: http://try.ocamlpro.com | Public channel logs at http://irclog.whitequark.org/ocaml
JacobEdelman has joined #ocaml
lobo has joined #ocaml
Simn has quit [Quit: Leaving]
<teknozulu> Looking for help in guiding the type system. I have type 'msg Worker_starter.t, along with any_t = Any : 'msg t -> any_t, which allows me to use collections despite having different type params. I've tried to do some annotation gymnastics, but I'm still getting type 'msg is not compatible with a for result on line 10, http://pastebin.com/7nJWdaLj (Without any annotations, I get msg#0 would escape its scope for result.)
<zozozo> teknozulu: try annotating the type of f and arg ?
<zozozo> and btw, I don't see the point of the unit argument
<teknozulu> it's to produce a function with the sig that a lib expects
<zozozo> seems strange
<octachron> teknozulu, Any is a dead end
kakadu has quit [Remote host closed the connection]
* teknozulu foams at the mouth
<octachron> if you only have Any: ' a -> any_t, you are forgetting the specific type 'a and you can never recover it
<octachron> you need to add a function to manipulate the type 'a; for instance Any: 'a * ('a -> 'do_something) -> any_t
<octachron> the idea is that you only know the type of 'a in the context of Any: i.e., the type cannot escape its scope
<octachron> so you need to add the function that can manipulate the type inside this Any context
NingaLeaf has joined #ocaml
AltGr has joined #ocaml
cyraxjoe has joined #ocaml
cyraxjoe_ has quit [Ping timeout: 255 seconds]
octachron has quit [Quit: Leaving]
hay207_ has joined #ocaml
hay207 has quit [Ping timeout: 245 seconds]
cyraxjoe_ has joined #ocaml
cody` has joined #ocaml
cyraxjoe has quit [Ping timeout: 264 seconds]
Algebr` has quit [Ping timeout: 255 seconds]
cyraxjoe has joined #ocaml
cyraxjoe_ has quit [Ping timeout: 272 seconds]
ncthom91 has joined #ocaml
cyraxjoe_ has joined #ocaml
cyraxjoe has quit [Ping timeout: 240 seconds]
Sorella has quit [Quit: Connection closed for inactivity]
cyraxjoe_ has quit [Ping timeout: 272 seconds]
cyraxjoe has joined #ocaml
NingaLeaf has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hay207__ has joined #ocaml
hay207_ has quit [Ping timeout: 240 seconds]
FreeBirdLjj has joined #ocaml
esad has joined #ocaml
cyraxjoe_ has joined #ocaml
cyraxjoe has quit [Ping timeout: 255 seconds]
NingaLeaf has joined #ocaml
hay207 has joined #ocaml
hay207__ has quit [Ping timeout: 264 seconds]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ncthom91 has joined #ocaml
shinnya has quit [Ping timeout: 276 seconds]
ncthom91 has quit [Client Quit]
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
cyraxjoe_ has quit [Ping timeout: 240 seconds]
<please_help> Are there any resources on using ctypes for performance-sensitive applications dealing with large amounts of data? Or any comprehensive resources on ctypes at all (benchmarks for various kinds of applications, dealing with complex composition, additional compatible modules and whatnot)?
<please_help> Also, what's cmeleon?
cyraxjoe has joined #ocaml
noplamodo has quit [Ping timeout: 244 seconds]
noplamodo has joined #ocaml
badon has quit [Quit: Leaving]
cyraxjoe_ has joined #ocaml
cyraxjoe has quit [Ping timeout: 256 seconds]
cyraxjoe has joined #ocaml
cyraxjoe_ has quit [Ping timeout: 246 seconds]
cyraxjoe has quit [Ping timeout: 240 seconds]
cyraxjoe has joined #ocaml
fluter has left #ocaml [#ocaml]
ryanartecona has joined #ocaml
fluter has joined #ocaml
cyraxjoe has quit [Ping timeout: 260 seconds]
cyraxjoe has joined #ocaml
cyraxjoe_ has joined #ocaml
cyraxjoe has quit [Ping timeout: 245 seconds]
ncthom91 has joined #ocaml
JacobEdelman has quit [Quit: Connection closed for inactivity]
pabs3 has joined #ocaml
cyraxjoe has joined #ocaml
esad has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cyraxjoe_ has quit [Ping timeout: 256 seconds]
badon has joined #ocaml
lobo has quit [Quit: leaving]
nicoo has quit [Ping timeout: 276 seconds]
AltGr has left #ocaml [#ocaml]
nicoo has joined #ocaml
<pabs3> is there a tool for ocaml that reports potentially vulnerable uses of Unix system/open_process* or vulnerabilities in ocaml code?
ncthom91 has quit [Ping timeout: 245 seconds]
struk|desk|away is now known as struk|desk
pierpa has quit [Ping timeout: 250 seconds]
cyraxjoe_ has joined #ocaml
cyraxjoe has quit [Ping timeout: 240 seconds]
AltGr has joined #ocaml
NingaLeaf has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cyraxjoe has joined #ocaml
cyraxjoe_ has quit [Ping timeout: 246 seconds]
JacobEdelman has joined #ocaml
johnelse has quit [Ping timeout: 240 seconds]
johnelse has joined #ocaml
johnelse is now known as Guest30742
mac10688 has quit [Ping timeout: 272 seconds]
palomer has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ygrek_ has joined #ocaml
jimt has quit [Ping timeout: 265 seconds]
struk|desk is now known as struk|desk|away
pabspabspabs has joined #ocaml
pabspabspabs has quit [Changing host]
pabspabspabs has joined #ocaml
pabs3 is now known as Guest8941
Guest8941 has quit [Killed (weber.freenode.net (Nickname regained by services))]
pabspabspabs is now known as pabs3
darkf has joined #ocaml
ncthom91 has joined #ocaml
struk|desk|away is now known as struk|desk
palomer has quit [Quit: palomer]
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
palomer has joined #ocaml
AlexRussia has quit [Ping timeout: 250 seconds]
shinnya has joined #ocaml
keep_learning has joined #ocaml
b4284 has joined #ocaml
<b4284> hello
<b4284> is there something similar to hoogle of haskell community in ocaml ?
jimt has joined #ocaml
<b4284> okay, this is cool https://ocamloscope.herokuapp.com/
<b4284> thanks for listening guys
<flux> b4284, we are great listeners!
<b4284> flux: you bet jya !
hay207 has quit [Ping timeout: 264 seconds]
hay207 has joined #ocaml
b4284 has quit [Ping timeout: 252 seconds]
Algebr` has joined #ocaml
keep_learning has quit [Quit: This computer has gone to sleep]
gustav___ has quit [Ping timeout: 276 seconds]
gustav___ has joined #ocaml
keep_learning has joined #ocaml
kushal has joined #ocaml
apache2 has joined #ocaml
apache2_ has quit [Read error: Connection reset by peer]
tizoc has quit [Ping timeout: 240 seconds]
_habnabit has quit [Ping timeout: 250 seconds]
jerith has quit [Ping timeout: 272 seconds]
jyc has quit [Ping timeout: 264 seconds]
<Algebr`> I'm creating a ref list of unit Lwt.ts that are cancelable, ie created with Lwt.task, and then I'm using plain List.iter to call Lwt.cancel on them. Unfortunately this is exiting my program with no exceptions or error conditions, but this is not what I want, especially as code after the List.iter isn't executing at all.
cschneid has quit [Ping timeout: 250 seconds]
sbrouf_ has joined #ocaml
keep_learning has quit [Quit: This computer has gone to sleep]
hay207 has quit [Ping timeout: 260 seconds]
JacobEdelman has quit [Quit: Connection closed for inactivity]
clockish has quit [Quit: bye]
clockish has joined #ocaml
teknozulu has quit [Ping timeout: 256 seconds]
Simn has joined #ocaml
jyc has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
_habnabit has joined #ocaml
FreeBirdLjj has joined #ocaml
cschneid has joined #ocaml
jerith has joined #ocaml
tizoc has joined #ocaml
<Algebr`> I also can't seem to find any way to catch the canceled exception, Exception: Lwt.Canceled.
hay207 has joined #ocaml
keep_learning has joined #ocaml
ygrek_ has quit [Ping timeout: 260 seconds]
palomer has quit [Quit: palomer]
ely-se has joined #ocaml
mcc has quit [Quit: Connection closed for inactivity]
palomer has joined #ocaml
palomer has quit [Client Quit]
AlexRussia has joined #ocaml
botter has joined #ocaml
<botter> Hi. On this blog: https://blog.sorpaas.com/my-experience-for-the-jane-street-interview/ the poster provides 3 code examples
<botter> but I'm not able to understand the third one
<botter> I don't have any experience with OCaml, so I'm hoping someone here would be able to help. He doesn't seem to be using his queue anywhere
<botter> example #3 seems to be functionally the same as #2
<botter> am I missing something?
palomer has joined #ocaml
palomer has quit [Client Quit]
<MasseR> g
nullcatxxx_ has joined #ocaml
mort___ has joined #ocaml
mort___ has left #ocaml [#ocaml]
ggole has joined #ocaml
julienXX has quit [Changing host]
julienXX has joined #ocaml
<edwin> botter: presumably there is some code missing there for actually removing elements from the hashtbl once your queue has grown beyond a certain size
<botter> Would that work though? That won't achieve constant space + time memoizatin
<botter> edwin: So I suppose I understood the OCaml stuff correctly, his solution just seems to be wrong :)
<botter> Thank you
<MasseR> botter: it might actually
<edwin> if you remove elements from the queue and hashtbl once the queue grows beyond a certain size you'll have an upper bound on the number of elements in the hashtbl
<edwin> and in the queue
<MasseR> The amortized time is constant
<botter> Yea but that isn't memoization then...
<edwin> its a cache
<botter> Ah yes, amortized constant time
palomer has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
struk|desk is now known as struk|desk|away
ely-se has quit [Quit: leaving]
FreeBirdLjj has joined #ocaml
ely-se has joined #ocaml
agumonkey has quit [Ping timeout: 260 seconds]
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
AltGr has left #ocaml [#ocaml]
keep_learning has quit [Ping timeout: 256 seconds]
tmtwd has joined #ocaml
gdsfh has joined #ocaml
huza has joined #ocaml
palomer has quit [Quit: palomer]
keep_learning has joined #ocaml
ollehar has joined #ocaml
octachron has joined #ocaml
<gdsfh> hello. I want to write ppx extension, but the crucial point is: can I get the name of file/module it processes now? So I need to get either "foo.ml" or "Foo" when extension is processing "foo.ml". Can anyone point me to the docs that cover this and similar questions?
keep_learning has quit [Ping timeout: 250 seconds]
keep_learning has joined #ocaml
kakadu has joined #ocaml
cyraxjoe_ has joined #ocaml
botter has quit [Quit: Page closed]
cyraxjoe has quit [Ping timeout: 264 seconds]
ollehar has quit [Quit: ollehar]
tmtwd has quit [Ping timeout: 245 seconds]
Algebr` has quit [Remote host closed the connection]
esad has joined #ocaml
cody` has quit [Quit: Connection closed for inactivity]
esad has quit [Quit: Textual IRC Client: www.textualapp.com]
mort___ has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
mort___ has quit [Quit: Leaving.]
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
shinnya has quit [Ping timeout: 250 seconds]
Haudegen has quit [Ping timeout: 272 seconds]
<octachron> gdsfh, looking at the compiler source, you can use Location.input_name
<gdsfh> octachron: thanks! So, sources are the preferred way to learn ppx-related stuff for now?
keep_learning has quit [Ping timeout: 240 seconds]
keep_learning has joined #ocaml
<Drup> gdsfh: not sure what you mean, but given the name of the file, getting the module is not difficult
<Drup> (cut at the first dot, capitalize)
Haudegen has joined #ocaml
sz0 has joined #ocaml
<octachron> gdsfh, I would say yes. Since ppx-related stuff are closely related to the compiler front-end, it is quite often easier to look at the compiler source to understant what is going on
<octachron> The other option would be to have a separated exhaustive documentation for ppx...but manpower for documentation is limited
<gdsfh> octachron: agreed. (I had a hope that somebody already wrote the docs, but I just can't find them.)
NingaLeaf has joined #ocaml
keep_learning has quit [Read error: Connection timed out]
keep_learning has joined #ocaml
MercurialAlchemi has joined #ocaml
MercurialAlchemi has quit [Remote host closed the connection]
<octachron> gdsfh, as far as I know, such documentation does not exist beyond some blog posts
<ggole> There's whitequark's post, but that's probably quite out of date by now
<Drup> it isn't really
shinnya has joined #ocaml
<Leonidas> anyone tried combining Haxe and OCaml?
<Drup> Leonidas: what would be the point ? the libraries ?
<Leonidas> Drup: yes, the libraries and the backends (apart from JS).
keep_learning has quit [Ping timeout: 240 seconds]
<Leonidas> I was thinking of using love2d, but there is no lua_of_ocaml, neither is haxe_of_ocaml, of which the latter could be quite neat for making games in OCaml.
<Drup> there were embryos of ocaml/lua things.
keep_learning has joined #ocaml
<please_help> Asking again:
<please_help> Are there any resources on using ctypes for performance-sensitive applications dealing with large amounts of data? Or any comprehensive resources on ctypes at all (benchmarks for various kinds of applications, dealing with complex composition, additional compatible modules and whatnot)?
<please_help> I also heard of cmeleon but I'm not sure what it is exactly (a ctypes replacement? A layer on top of ctypes? An extension to ctypes?)
<Leonidas> please_help: have a link for cmeleton?
<rks`> looks like an alias for ctypes.
<Drup> please_help: I don't think anyone really made a detailed benchmark like this
<Drup> please_help: but for "large amount of data" the cost of the FFI is going to be negligeable anyway, isn't it ?
<kakadu> I have teached toplevel recently to use normal ocaml values (of type Ast_mapper.mapper) as ppx preprocessors. https://github.com/ocaml/ocaml/compare/4.02.3...Kakadu:fast-ppx-invocation Could you recommend a good name for a directive to add them?
Haudegen has quit [Ping timeout: 245 seconds]
<Drup> #ppx_mapper
lobo has joined #ocaml
<kakadu> thx
<please_help> drup: if passing an array through the FFI involves a copy, then the cost would be prohibitive in all but the most trivial such programs. The copy itself would take up too much cpu time, let alone memory. The copy-less options seem to be carray and bigarray, but I don't see feature or performance comparisons around. Aside from that, working with true 64-bit values could incur additional costs.
<please_help> There's also the issue of adding a finalizer that will be called in time, or other mechanisms to attach cleanup procedures to foreign pointers.
<Drup> please_help: ok, so your question is not about ctypes, it's about C FFI in general
<kakadu> Also I want to discuss the right implementation of generic printer. I have some functions to be declared in the js_of_ocaml toplevels and I need to print some values in human readable way. At the moment I use a function 'a -> string with implementation similiar to Extlib's Std.dump
<Drup> in this case, Bigarray is your solution
ely-se has quit [Quit: leaving]
<kakadu> Maybe I can reuse toplevel's generic printers but I need to get the types of values somehow. Also I thought about modules implicits....
<kakadu> modular*
cdidd_ has quit [Ping timeout: 260 seconds]
<Drup> please_help: there are finalizer things in ctypes, iirc
sbrouf_ has quit [Ping timeout: 240 seconds]
<please_help> drup: are those different from finalizers registered with the GC?
<Drup> I checked, no, they are just doing the right things
pierpa has joined #ocaml
<please_help> Good to know. Then, what's the difference between carray and bigarray, and why is bigarray more appropriate in my case?
cdidd has joined #ocaml
<Drup> carray induce a cost through the FFI to manipulate the array
<Drup> (at least, afaiu how it's implemented)
<Drup> bigarray do not, they are just a big consecutive chunk of memory that fortunately happen to map to the C memory representation. :p
<Drup> (and, most importantly, the GC doesn't move them)
<please_help> I see. And how are 64-bit values that require the last bit handled?
<ggole> Int64.t
struk|desk|away is now known as struk|desk
<please_help> Isn't that only 63 bits plus a tag bit?
<Drup> No, it's a boxed integer of 64 bits
<Drup> "int" on 64 plateforms is the one you are thinking of, unboxed integer of 63 bits
Haudegen has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 265 seconds]
FreeBirdLjj has joined #ocaml
<please_help> OK, and bigarray uses its own "element type" to use unboxed C ints or longs then. When a number is gotten from the array, is it as int or Int64.t?
<please_help> and is there a Float32.t? I imagine not?
<please_help> for the sake of not having a double-sized boxed set of floats.
ely-se has joined #ocaml
<edwin> please_help: ctypes and performance-sensitive code ... maybe tgls, and for cstubs and tgls there is https://github.com/dbuenzli/tgls/pull/14, but I don't know of any benchmarks
<Drup> please_help: the type you get from an array depends on the array
<Drup> and no, a float32 is simply a float
<please_help> drup: of course the type depends on the array, but would a in64 array return values as int or as Int64.t?
<Drup> In64.t, otherwise you would lose information
<please_help> OK. Thanks drup and ggole.
<Drup> (the documentation formatting on this page is a complete catastrophe :/ )
<edwin> (yeah it used to look way better)
<Drup> for each constructor, first type parameter is the type of the element out of the array
govg has joined #ocaml
MercurialAlchemi has joined #ocaml
<edwin> Drup: should I report that on mantis, or would you like to do that?
<Drup> edwin: go on
<octachron> edwin, as an information complement, the problem is with the new association rule for docstring comment on constructors
<Drup> yeah, I was wondering how to fix it, because the problem is more general (and quite annoying)
mort___ has joined #ocaml
<octachron> the initial PR suggests using (** *)
<Drup> octachron: look at the source, it's already using (** *), but after, not before
<Drup> I don't think saying "you should put it before" is a right answer
struk|desk is now known as struk|desk|away
ncthom91 has joined #ocaml
<octachron> Drup, sorry, the suggestion was to add an empty docstring (** *) just after the last variant and before the existing docstring comment.
<Drup> that sucks, and that breaks documentation.
<rks`> I think that would work yes
<rks`> how does it "break documentation" Drup ?
<Drup> rks`: documentation was well rendered before, it's screwed up after
<rks`> .
<Drup> I had to modify some of my packages because of this, because the documentation was not well rendered in the last ocaml version
<Drup> aka, "broken"
struk|desk|away is now known as struk|desk
<mrvn> How do I declare an abstract class? I want to bind c++ classes and preserve the inheritance.
FreeBirdLjj has quit [Remote host closed the connection]
<Drup> remind me what abstract classes are, in C++'s verbiage ?
<mrvn> "type t" in ocaml
<ely-se> mrvn: https://realworldocaml.org/v1/en/html/classes.html ctrl+F "class virtual"
<mrvn> I need to put a type on the c+ pointer with inheritance.
<ely-se> Drup: C++ abstract is OCaml virtual
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Drup> right
<Drup> :overloaded keywords:
<ely-se> not to be confused with C++ virtual :)
<mrvn> I don't want c++'s abstract but ocamls abstract
<Drup> Ah
<ely-se> classes in OCaml aren't types, AFAIK
<Drup> that is not exactly true
<Drup> for each class, there are two associate types
noleman has joined #ocaml
<Drup> for a class c, the type c is the natural translation to types
<mrvn> maybe I could have a "type 'a cpp_ptr" and put the inheritance into the 'a
<Drup> and the type #c is the open version
<Drup> (same deal for class types)
<Drup> mrvn: what are you trying to do exactly ?
<Drup> (like, show me a simplified example)
<mrvn> Build bindings for QT5 widgets that preserve the inheritance.
<Drup> given that I don't know QT5 and barely know C++'s special flavor of OOP, that doesn't help me :D
<mrvn> I have QObject, QWidget, QButton. I want the QButton to inherit the method from QWidget and to be able to pass a QButton to methods expecting a QWidget
adwhit has joined #ocaml
<Drup> ah, but your things are not actual objects ?
<mrvn> No, they are c++ classes
<Drup> they are abstract thingies provided by the FFI ?
<Drup> right
<Drup> phantom object types, then
<Drup> no other solution.
<adwhit> hi, can someone help me understand how to use ppx_deriving, I'm trying to use it in the interactive prompt but getting a syntax error
keep_learning has quit [Quit: This computer has gone to sleep]
<Drup> adwhit: version of OCaml ?
<adwhit> Drup: 4.02.3
<adwhit> utop # type t = int [@@deriving show];; Error: Parse error: [str_item] or ";;" expected (in [top_phrase])
<rks`> you're using camlp4.
<rks`> can you show the content of your .ocamlinit?
<Drup> mrvn: you might want to look at jsoo's typing
<adwhit> rks`: ah ok, I'm completely new to this
<rks`> it's a pain even if you're not new, no worries
<mrvn> jsoo? or json?
<Drup> js_of_ocaml
<Drup> I need to make a macro to insert it for me :D
<adwhit> rks`: #use "topfind";; #thread;; #camlp4o;; #require "core.top";; #require "core.syntax";; open Core.Std
<Drup> adwhit: remove "#camlp4o;;"
<Drup> (I think it's enough)
<adwhit> Drup: thanks, I also had to remove core.syntax
<Drup> ah, yes, indeed
<adwhit> (I just copy-pasted that init from some tutorial)
<Drup> RWO, I would guess
<adwhit> Of course :)
<Leonidas> adwhit: there will be a version of Core that doesn't depend on Camlp4
mort___ has quit [Remote host closed the connection]
<rks`> even if core depends on camlp4
<rks`> you don't need to have it in the toplevel
<rks`> (but yes, the next release of core will not depend on camlp4)
<Drup> what you need is a version of RWO without camlp4 :3
<rks`> that should also appear
<rks`> (someday.)
<adwhit> Thanks all, got it working now
<adwhit> right, now stuck on getting a test to compile, maybe someone can help..
<adwhit> File: type tt = | TRUE | FALSE [@@deriving show] let () = Format.printf "True? %a@" pp TRUE; ()
<adwhit> ocamlfind opt test.ml -package "ppx_deriving.show" File "test.ml", line 6, characters 35-37: Error: Unbound value pp
<Drup> pp_tt, in your case
<Drup> it's called "pp" only if the type is named "t"
<adwhit> Drup: Great, thanks, I should read the docs more carefully. But then I get "Error: No implementations provided for the following modules: Ppx_deriving_runtime referenced from test.cmx"
<adwhit> (as you can tell I'm a complete noob)
<Drup> how do you compile ?
<adwhit> ocamlfind opt test.ml -package "ppx_deriving.show"
<Drup> add -linkpkg
<adwhit> Drup: Whew, it works, thank you very much. And grr tooling
<Drup> indeed :/
BitPuffin|osx has quit [Ping timeout: 255 seconds]
<mrvn> method destroy = destroy (this :> 'self qt_ptr)
<mrvn> Self type cannot escape its class
<mrvn> How do I fix that again?
ncthom91 has joined #ocaml
JacobEdelman has joined #ocaml
FreeBirdLjj has joined #ocaml
struk|desk is now known as struk|desk|away
sbrouf_ has joined #ocaml
keep_learning has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AlexRussia has quit [Quit: WeeChat 1.4-dev]
AlexRussia has joined #ocaml
<octachron> mrvn, how do you ensure that 'self is a subtype of 'self qt_ptr? The dummy code "object (this : 'self) method destroy = noop (this :> 'self identity) end" works
ely-se has quit [Quit: leaving]
<mrvn> octachron: this is the c++ pointer, not the object
<mrvn> class qFoo obj = object(self:'self) val this = obj ... end
adwhit has quit [Ping timeout: 252 seconds]
noleman has quit [Remote host closed the connection]
<octachron> mrvn, this code ^ compiles for me, even with (this :> 'self ptr)?
<octachron> note that you have the problem that 'a ptr is probably not covariant in 'a
<mrvn> octachron: I can inherit qObject in qApplication and qMainWindow
<mrvn> the "#" makes it work
Guest30656 is now known as c-c
<sbrouf_> anyone using nanoMQ here ?
<sbrouf_> or any simple message queue lib ?
<mrvn> Hmm, can I somehow make a class that can be called but not saved? I want "window#menuBar#addMenu" to work but not "menuBar = window#menuBar" since the menuBar disapears when the window gets closed.
<mrvn> (if that makes any sense)
<def`> you can't
<mrvn> are you sure. *wearing evil hat* What about making window#menuBar take a closure that gets invoked with a local type derived from QMenuBar that may not escape it's scope?
<def`> then I can use closure/reference/module/gadts
<def`> to hide the type and make the value escape
<mrvn> don't think so.
<def`> I am sure I can.
<def`> So it would be very verbose and not 100% effective.
<mrvn> you couldn't specify the type for the module or gadts and references give the "may not escape its scope" error
<def`> You should not try to fight against the developer... Just protect your code by detecting uses that escaped the score?
<def`> type ex = Ex : 'a -> 'a ex
<mrvn> def`: Yeah. but for that I have to track all copies of the MenuBar being made and invalidate them when the window gets closed.
<def`> pretty sure your value will fit in Ex.
cody` has joined #ocaml
<def`> And I don't want to show you all the different possible encodings.
<mrvn> def`: but you can't use it
<def`> Pfff.
kakadu has quit [Quit: Page closed]
<mrvn> you need a witness type to use it and that you can't specify.
<def`> Anyway, no it is not possible in OCaml. You have to track the uses dynamically.
<def`> You can use a monad to enforce linear use of the API, but you probably don't want that.
AlexRussia has quit [Quit: WeeChat 1.4-dev]
<mrvn> lets see if I can extract the QMenuBar from the QMainWindow on close so it remains behind till the ocaml obejct gets cleaned up too
<mrvn> :( one can't. QT's memory management sucks for interacting with a GC.
jeffmo has joined #ocaml
AlexRussia has joined #ocaml
<def`> yes
<def`> this time gtk did something right
<mrvn> how so?
<def`> reference counting
<mrvn> just don't create any loops :)
<def`> couldn't you have a variable/ref that you change when your main object is release ?
<mrvn> QObject has a "destroyed" signal. So at least I can have the ocaml object listen for the QT object disapearing
<def`> so that the menubar will juste have to check for validity before any action
<mrvn> def`: I can. But then you call "menubar#addMenu()" and it has to give a runtime error.
<def`> you rarely have recursive widgets :D
<def`> mrvn: it has yes
<def`> there is no static way to enforce that
<mrvn> tree views have them.
BitPuffin|osx has joined #ocaml
<def`> (even worse if the user use threads)
<def`> how so?
<mrvn> QT objects are not thread save. May only be used in the thread that creates them
<mrvn> def`: tree views have items with parent and children pointer.
<def`> they don't have to
<def`> it is just one possible implementation
<mrvn> if they don't then your code becomes a nightmare
ncthom91 has joined #ocaml
<def`> plus it is a model, not a widget
<def`> and the weak reference is pretty obvious
cyraxjoe_ has quit [Read error: Connection reset by peer]
<def`> (this apply to most containers in a gui actually... children generally keep a ref to their unique parent)
<mrvn> I wish QT5 would just use std::shared_ptr
<mrvn> and weak for parent
<def`> what are you using it for ?
cyraxjoe has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
<mrvn> want to make some simple GUIs
<def`> that has always been a pain in OCaml, good luck :(
<mrvn> All the QT5 bindings I've seen so far need qml, c++ and ocaml code to make anything not trivial. that pretty much sucks.
<please_help> Linear types when?
<def`> I doubt linear types will ever come in OCaml
<mrvn> *grml* back to scope escaping: http://paste.debian.net/356754/
palomer has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
palomer has quit [Quit: palomer]
palomer has joined #ocaml
mawuli is now known as yaw
yaw is now known as rpip
kakadu has joined #ocaml
<yminsky> Has anyone taken a look at wrapping virtual-dom for OCaml? https://github.com/Matt-Esch/virtual-dom
<yminsky> Having played a little with Elm, it seems like a pleasant idiom for interacting with the DOM, and I don't see an obvious alternative in OCaml.
oriba has joined #ocaml
ygrek_ has joined #ocaml
<edwin> https://ocsigen.org/eliom/manual/clientserver-html#reactive does this use DOM diffing/patching?
<yminsky> That uses React, I think, rather than diffing and patching. React seems like a somewhat more heavyweight approach to me than just having a simple object that supports a diff operation.
<yminsky> The nice thing about diffing values is that you're free to generate your values however you want (including incrementally)
sbrouf_ has quit [Quit: Quitte]
sbrouf has joined #ocaml
demonimin has joined #ocaml
zpe has quit [Remote host closed the connection]
zpe has joined #ocaml
ncthom91 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zpe has quit [Ping timeout: 260 seconds]
<edwin> hmm patch seems to be supported by update_children here, not sure how to create the diff if all you have are two DOMs though: https://github.com/ocsigen/js_of_ocaml/blob/master/lib/tyxml/tyxml_js.mli
palomer has quit [Quit: palomer]
tmtwd has joined #ocaml
<mrvn> How do I write an "object('self) method this : 'self ptr end" so that the self type does not escape its class?
badon has quit [Quit: Leaving]
palomer has joined #ocaml
<yminsky> Zoggy's xmldiff seems to do something rather similar: http://zoggy.github.io/xmldiff/
<yminsky> It doesn't have the typed-XML API of tyxml, but it does seem to diff-and-patch-the-dom.
JacobEdelman has quit [Quit: Connection closed for inactivity]
keep_learning has quit [Quit: Leaving]
<please_help> The functions in the Unix module isn't portable right?
ncthom91 has joined #ocaml
<mrvn> works on any posixish system
<please_help> windows' posix layer hasn't been available for a while now, unfortunately.
<adrien> they are ported
<adrien> Unix is modelled after the unix API and C API
<mrvn> just don't assume Unix.file_descr is an int
darkf has quit [Quit: Leaving]
palomer has quit [Quit: palomer]
<please_help> so it's actually portable and maps to a Unix-like API for ocaml program, but doesn't rely on the underlying system being posix-compliant-ish?
<adrien> exactly
<adrien> a few functions are not available and that is documented
zpe has joined #ocaml
<please_help> great!
<please_help> Is there an equivalent to batteries' Safe_int for Core? Additionally, are there statistic primitives for integers (since they overflow), like averaging and the like?
palomer has joined #ocaml
nullcatxxx_ has joined #ocaml
ggole has quit []
mcc has joined #ocaml
BitPuffin|osx has quit [Ping timeout: 260 seconds]
tmtwd has quit [Ping timeout: 246 seconds]
shinnya has quit [Ping timeout: 276 seconds]
ncthom91 has quit [Quit: Textual IRC Client: www.textualapp.com]
struk|desk|away has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 260 seconds]
<please_help> is the best way to average numbers to define the primitive let average a b = (a lxor b) asr 1 + (a land b) ; and compose it as needed or is there an inbuilt function for that?
<pierpa> I believe the best way to average two numbers is (a+b)/2
<pierpa> (I'm old fashioned)
Algebr` has joined #ocaml
<Algebr`> So I pretty much want to fall on a sword. Lwt code that works 100% correctly on OS X doesn't work on Linux.
Simn has quit [Quit: Leaving]
Haudegen has joined #ocaml
<please_help> pierpa: this overflows and doesn't correctly rounds off.
<pierpa> but why you want to average ints?
Guest38 has joined #ocaml
<pierpa> overflows ok. But why doesn't round off correctly?
<please_help> pierpa: actually it rounds correctly unlike the version I posted. As for why averaging ints, it's useful for index-related operations, for example. When a lot of data is involved, having to cast and move tanks performance.
<pierpa> ok. ty
<tautologico> please_help: I don't think there is an averaging function in the standard library
ryanartecona has joined #ocaml
<edwin> Algebr`: whats the trouble on Linux?
tmtwd has joined #ocaml
<Algebr`> edwin: I just found it. The difference came down to Lwt_list.iter_s or iter_p
<Algebr`> on linux using iter_s just blocked, the program did not continue but iter_p was fine.
Haudegen has quit [Ping timeout: 255 seconds]
<edwin> I don't think the implemention of those two would be different between OSes
<Algebr`> something is different because I have a reproducible test case.
<edwin> whats the function that you call with iter_s
palomer has quit [Quit: palomer]
<edwin> could that behave differently?
<Algebr`> differently on linux or OS X?
palomer has joined #ocaml
<edwin> yes
<edwin> could you pastebin your testcase?
<Algebr`> possibily, but i don't see where it could. It creates a Lwt_io.server, which is then given to Lwt.ignore_result and then gives back a Lwt.t created with Lwt.task
<Algebr`> edwin: I'm writing up the github issues thing for lwt atm, all details will be there.
JacobEdelman has joined #ocaml
<edwin> interesting use of Lwt.task and cancel, I think I would expect the blocking behaviour to be correct here
<edwin> the only way iter_s should make progress is if the task finishes (but the wakener is thrown away), or its canceled
<Algebr`> then how is this working on os x
<Algebr`> its inconsistent..
<Algebr`> and then doing iter_p "solves" the problem
<edwin> there are 3 engines, select,poll and libev, which one is used on OSX?
Haudegen has joined #ocaml
<Algebr`> what's the easy way to find out, Lwt_engine.get just gives back Lwt_engine.t which is some object
<Algebr`> in anycase I thought it always picked libev
<Algebr`> i guess it might just not be on the system and hence its using select?
<Algebr`> edwin: okay, neither are using libev
<Drup> Algebr`: set them, and try
<Drup> with each engine
<Drup> Algebr`: anyway, cancel's semantic is delicate, because all the tasks are not cancelable
<Algebr`> Drup: Exception: Lwt_sys.Not_available "libev_init". for both
<Drup> you could try to use a fuse, instead of cancel, by making a sleeping thread and pick the sleeping thread and the other threads. If you want to terminate early, you wake up the sleeping thread
<Algebr`> interesting name, fuse, and yes that's a good idea, but for now I'm going to just switch to iter_p as it solves this mystery for now.
<Drup> Algebr`: like an electric fuse :)
<Drup> you blow it up :p
<Algebr`> ha
ely-se has joined #ocaml
<edwin> it remains to be determined if its select or poll then
ryanartecona has quit [Ping timeout: 260 seconds]
<Algebr`> yes and i don't know how to test for that
ryanartecona has joined #ocaml
<edwin> ok so it seems to pick select by default if libev is not there
<Algebr`> Okay, then they both ought to be select :)
<Algebr`> presumaly libev is the best engine? I wonder if opam lwt installation can install that for me, via opam-ext or soemthing
<edwin> conf-libev
<Algebr`> there's a nice tipping point between worth it and hassle.
<octachron> Drup, "Arguably, this is"? :p
<Drup> fingers on a keyboard were involved in this accident.
<Drup> I blame them.
MercurialAlchemi has quit [Ping timeout: 240 seconds]
BitPuffin|osx has joined #ocaml
groovy2shoes has quit [Quit: Leaving]
groovy2shoes has joined #ocaml
pyon has quit [Quit: Loops are hard, let's GOTO shopping!]
teknozulu has joined #ocaml
mac10688 has joined #ocaml
palomer has quit [Quit: palomer]
<Algebr`> was there an easy stdlib or lwt check if platform is darwin or linux?
<Algebr`> sys's os_type conflates them, "Unix" (for all Unix versions, including Linux and Mac OS X),
<Drup> Sys.os_type ?
<Drup> oh, no
<Algebr`> great.
palomer has joined #ocaml
<Algebr`> yep, need to shell it out.
<Drup> Algebr`: call to uname -a
<Drup> ?
<Drup> right
palomer has quit [Quit: palomer]
<Algebr`> Linux sys log doesn't like terminal colored strings, just leaves them escaped while OS X system log prints out colored strings correctly.
<Drup> that is surprising
micro___ is now known as micro_
<ely-se> software being broken is never surprising
<ely-se> you should lower your expectations. it'll increase your quality of life
hay207_ has joined #ocaml
hay207 has quit [Ping timeout: 255 seconds]
hay207__ has joined #ocaml
hay207_ has quit [Ping timeout: 240 seconds]
pyon has joined #ocaml
ryanartecona has quit [Quit: ryanartecona]
ely-se has quit [Quit: Leaving...]
hay207__ has quit [Quit: Konversation terminated!]
hay207__ has joined #ocaml
hay207__ has quit [Ping timeout: 245 seconds]
Haudegen has quit [Ping timeout: 265 seconds]
hay207__ has joined #ocaml
ryanartecona has joined #ocaml
hay207 has joined #ocaml
badon has joined #ocaml
hay207__ has quit [Ping timeout: 276 seconds]
Denommus has joined #ocaml
octachron has quit [Quit: Leaving]
Haudegen has joined #ocaml