nicholasf has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 250 seconds]
<gasche>
Algebr: class foo (f : _ -> unit) = object (self) method _call = f self end works
<gasche>
(or (f : 'a -> unit) ... object (self : 'a) ... end, for that matter)
dsheets has joined #ocaml
<gasche>
another type that also works is
<gasche>
class foo (f : foo -> unit) = object (self) method _call = f (self :> foo) end
<gasche>
but this is more restrictive, as f is not polymorphic over foo's extensions
walter|r has joined #ocaml
nicholasf has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
<Algebr>
foo is supposed to be an the instance of foo itslef
<Algebr>
ah, thank you
dsheets has joined #ocaml
walter|r has quit [Ping timeout: 260 seconds]
dsheets has quit [Ping timeout: 250 seconds]
NingaLeaf has joined #ocaml
NingaLeaf has quit [Client Quit]
<Algebr>
Drup: how do I turn a Js.Unsafe.any into a float or an int
NinjaTree has joined #ocaml
nicholasf has quit [Ping timeout: 260 seconds]
nicholasf has joined #ocaml
kalzz has quit [Quit: exit]
mechanical-pyon is now known as electric-pyon
NinjaTree has quit [Quit: Leaving.]
<whitequark>
electric-pyon: but why
destrius has joined #ocaml
NinjaTree has joined #ocaml
dsheets has joined #ocaml
darkf has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
ril has joined #ocaml
walter|r has joined #ocaml
walter|r_ has joined #ocaml
walter|r has quit [Read error: Connection reset by peer]
Algebr has quit [Ping timeout: 252 seconds]
sh0t has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ril has joined #ocaml
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Algebr has joined #ocaml
govg has joined #ocaml
Reshi has joined #ocaml
<Algebr>
Drup: setInterval is in Dom_html.mli but when I try using it I get unbounded value, on 2.7
<Algebr>
oh its on the window object
silver has quit [Quit: rakede]
adelbertc has quit [Quit: Connection closed for inactivity]
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 252 seconds]
walter|r_ has quit [Remote host closed the connection]
yegods has quit [Remote host closed the connection]
dsheets has joined #ocaml
sh0t has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 250 seconds]
NinjaTree has quit [Quit: Leaving.]
johnelse has quit [Ping timeout: 260 seconds]
dsheets has joined #ocaml
johnelse has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
misterme_ has joined #ocaml
mistermetaphor has quit [Ping timeout: 260 seconds]
Algebr has quit [Remote host closed the connection]
Algebr has joined #ocaml
git-commit has quit [Ping timeout: 240 seconds]
vpm has quit [Ping timeout: 244 seconds]
vpm_ has joined #ocaml
git-commit has joined #ocaml
johnelse has quit [Ping timeout: 276 seconds]
Algebr has quit [Ping timeout: 252 seconds]
johnelse has joined #ocaml
pierpa has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Read error: Connection reset by peer]
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
MercurialAlchemi has joined #ocaml
shinnya has joined #ocaml
<struk|desk>
awesome, think I conditionally depended on something with opam + _oasis. glorious day
<struk|desk>
I also learned how about FindLibName
<struk|desk>
sorry, FindLibParent
shinnya has quit [Ping timeout: 260 seconds]
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
badon has quit [Ping timeout: 276 seconds]
dsheets has joined #ocaml
solrize has quit [Ping timeout: 276 seconds]
dsheets has quit [Ping timeout: 250 seconds]
ungz has joined #ocaml
dsheets has joined #ocaml
d0nn1e has quit [Ping timeout: 252 seconds]
dsheets has quit [Ping timeout: 250 seconds]
Algebr has joined #ocaml
mistermetaphor has joined #ocaml
misterme_ has quit [Ping timeout: 252 seconds]
A1977494 has joined #ocaml
Mercuria1Alchemi has joined #ocaml
misterme_ has joined #ocaml
rgrinberg has quit [Quit: WeeChat 1.4]
mistermetaphor has quit [Ping timeout: 276 seconds]
A1977494 has quit [Ping timeout: 252 seconds]
Reshi has quit [Quit: WeeChat 1.4]
nichola__ has joined #ocaml
d0nn1e has joined #ocaml
nicholasf has quit [Ping timeout: 250 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
solrize has joined #ocaml
A1977494 has joined #ocaml
Simn has joined #ocaml
misterme_ has quit [Remote host closed the connection]
nicholasf has joined #ocaml
nichola__ has quit [Ping timeout: 246 seconds]
pierpa` has joined #ocaml
electric-pyon is now known as mabino-pyon
pierpa has quit [Ping timeout: 252 seconds]
badon has joined #ocaml
govg has quit [Ping timeout: 244 seconds]
seliopou has quit [Ping timeout: 244 seconds]
govg has joined #ocaml
nicholasf has quit [Remote host closed the connection]
seliopou has joined #ocaml
nicholasf has joined #ocaml
nicholasf has quit [Ping timeout: 252 seconds]
nicholasf has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
seliopou has quit [Ping timeout: 250 seconds]
seliopou has joined #ocaml
kushal has joined #ocaml
bba has joined #ocaml
al-damiri has joined #ocaml
rntz has quit [Ping timeout: 276 seconds]
<maker>
hello! Another small issue over here, and you might be able to help.
<maker>
The PKCS1 signatures I am providing using Nocrypto.Rsa.PKCS1.sig_ecode are invalid, or better, they are not as expected.
<maker>
Right now I am confronting it with a Go implementation, and probably this is because Nocrypto " performs only the padding and RSA transformation steps of the PKCS 1.5 signature."
<maker>
Is there any OCaml package where I can read how to do a full PKCS1 signature (maybe there's a hash identification to add on the rsa signature or something?)
mehdib has quit [Remote host closed the connection]
* maker
just realized hannes made an awesome ocaml-tls library, so he read the sourcecode and found a solution for his problem.
<maker>
now we have a jws library!
<maker>
hannes: also, what I am writing here will be soon translated into fstar. This implies as well that they will ask me to move into CryptoCore, a library F* people use. It is a wrapper over OpenSSL bindings.
<maker>
hannes: How would you suggest me to proceed, should I fork, or maybe I can make a functor and try to support both?
<maker>
I never truly used functors, therefore the second option might not be possible in reality
govg has quit [Quit: leaving]
<Drup>
You'll have to learn functor at some point anyway :p
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
amnn has joined #ocaml
rntz has joined #ocaml
<maker>
mm conventionally unittests should be in a test/ directory and src in lib/? Projects seem to be inconsistent
Mercuria2Alchemi has joined #ocaml
<hannes>
maker: to be clear, ocaml-tls was done by david and me, not me alone :)
freehck has joined #ocaml
<hannes>
maker: your main library should include the protocol logic only, and don't care about which crypto lib etc. is used
<maker>
hannes: yes, I know, but my proposition is still true :P
Mercuria1Alchemi has quit [Ping timeout: 240 seconds]
<maker>
hannes: yes, I need to move some stuff around also to formally verify that code. But how can I interface to different crypto libraries? Making a big other module (taking a functor?) that exports only the functonalities needed?
<hannes>
maker: define a signature containing the stuff you actually need (types); then write an implementation thereof in terms of corecrypto, another in terms of nocrypto... and then abstract your protocol logic over that signature
<reynir>
Where is B64u from?
<maker>
reynir: it's just anothe module I wrote to urlencode/urldecode stuff
<maker>
reynir: it's on the top of "base64"
<reynir>
oh it's right there
<maker>
also there's another base64 implementation in Nocrypto, wonder why
<maker>
(didn't check tho, maybe it's based on B64)
<hannes>
maker: historical reasons, different implementation strategies..
jwatzman|work has joined #ocaml
pierpa` is now known as pierpa
larhat has joined #ocaml
<Khady>
maker: do you plan to implement the full rfc for jws? I was planning to create a library for jws too, but if there is already yours, I won't duplicate the work
<maker>
Khady: I plan just to implement what's needed to make acme work, but any contribution is very welcome. From half may onwards, I won't be able to play very much with it (gettin my master's…)
<maker>
Khady: I could even let you write access to the repository
<Khady>
I'm fine with the pull request system until I make very big contributions :)
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
govg has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
ungz has quit [Ping timeout: 250 seconds]
<maker>
Khady: very well :)
<maker>
also even though people here are familiar with ocaml and engeneering crypto protocols, they aren't really into opam/oasis and all this packaging suff, so please tell me if I should reorganize things!
<_y>
« 8. Exceptions: I love OCaml's extremely fast exception handling (6x faster
<_y>
than C++, 30x faster than Java and 600x faster than C#/F#!). I hate
<_y>
advocates of any language implementation with cripplingly-slow exception
<_y>
the "exceptions are for exceptional circumstances" line promoted by the
<_y>
is this still up‐to‐date, with respect to the relative performances claimed here?
<maker>
functional programming question: there's this client_t type "cli" that every time is used by use_cli_in_some_way needs to hold a fresh new value for a record "nonce".
<maker>
now I can either make that "nonce" record a ref and rewrite it every time
<maker>
or return also a new cli object
<_y>
since there seems to be a movement stepping back towards option‐passing rather than exception‐throwing now
<maker>
is there any reason why I should prefer one to the other?
<Drup>
_y: OCaml excecptions are still as fast, no idea about the other languages
<maker>
_y: in general the reason for this trend is not performance but the resulting convoluted code
<toolslive>
exceptions are just functional goto's ;)
<_y>
Drup, so in the absolute the exception‐throwing style has no performance issue?
dsheets has joined #ocaml
<_y>
well, except maybe for recursive calls
<Drup>
depends on the code pattern
<zozozo>
_y: well actually, I think the match with exception E -> syntax helps having tail-call recursive functions with exceptions
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
<_y>
indeed
mehdib has joined #ocaml
kakadu has joined #ocaml
bba has joined #ocaml
silver has joined #ocaml
nicholasf has quit [Remote host closed the connection]
nicholasf has joined #ocaml
silver has quit [Client Quit]
silver has joined #ocaml
boegel has quit [Remote host closed the connection]
boegel has joined #ocaml
noethics has quit [Ping timeout: 240 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
mehdib has quit [Ping timeout: 276 seconds]
FreeBirdLjj has joined #ocaml
mehdib has joined #ocaml
vpm_ has quit [Quit: co'o]
vpm has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<flux>
if the alternative is to construct an (ie.) option, exception-style may as well be faster. I wonder though if flambda addresses this.
abruanes- is now known as abruanese
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bba has joined #ocaml
bba has quit [Client Quit]
<zozozo>
flux: well, you have to construct the exception as much as the option (except for the recent constant or local exceptions maybe ?), so...
<flux>
zozozo, well, raise Not_found? should be pretty fast to construct?
<flux>
but a good point regardless
<zozozo>
i don't know, I remember some github PR about having static exceptions the do not need allocation so that they may be used better for control flow
<def`>
Not_found is constant, no need to construct (or you can do let not_found = Not_found to allocate only once)
<def`>
static exceptions is local and is quite restrictive on the control flow (no higher-order construct)
<_y>
if you are e·g· iterating on a file’s lines, you only have to throw an exception once (and End_of_file is a constant one), as opposed to wrap your result into an option and destruct it immediately at each iteration
<zozozo>
right, guess the question is then the proportion of expected "failures" of a function
kushal has quit [Read error: Connection reset by peer]
nicholasf has quit [Remote host closed the connection]
<def`>
_y: that costs the more in this case is setting the exception handler
<def`>
waht*
<def`>
pfff... I am tired.
dsheets has quit [Remote host closed the connection]
<_y>
but isn’t it only a matter of gotos?
<_y>
resolved at compile time
yegods has joined #ocaml
averell has joined #ocaml
<def`>
_y: with static exceptions yes :)
<def`>
(sorry, I meant with dynamic one, the cost is in the setting the handler at each iteration when reading lines)
myst|fon has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
lokien_ has joined #ocaml
bba has joined #ocaml
yegods has quit [Ping timeout: 260 seconds]
yegods has joined #ocaml
wolfcore has quit [Ping timeout: 240 seconds]
nicholasf has quit [Remote host closed the connection]
dsheets has joined #ocaml
solrize has quit [Ping timeout: 250 seconds]
solrize has joined #ocaml
wolfcore has joined #ocaml
kushal has joined #ocaml
al-maisan has joined #ocaml
ggole has joined #ocaml
<flux>
if they want a goto to ocaml they should call it goto.. :)
<flux>
it seems annoying that you cannot just take a fragment and put it inside a function, because now its `Exception won't work anymore
pierpa` has joined #ocaml
<flux>
maybe if it were possible to explictly pass the exception as a parameter, much like I can transform let foo = .. in 42 + foo pretty much brainlessly into let bar foo = 42 + foo let foo = 42 in bar foo
<flux>
but I suppose that would be quite much bigger language feature
pierpa has quit [Ping timeout: 252 seconds]
pierpa` is now known as pierpa
<zozozo>
flux: well, if there is in an "aux" function a goto that goes in another function's body, that would be weird, and pretty much why gotos are bad
<flux>
but exceptions are pretty much invented for returning to a level beyond the current scope
<zozozo>
yup, exceptions, not gotos
<toolslive>
exceptions as parameters has problems with typing, no ?
<Drup>
toolslive: no
<zozozo>
you can very well take an argument of type 'exn'
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<toolslive>
yes, but you cannot make them polymorphic
<flux>
exceptions form ocaml's dynamic type system :)
<flux>
toolslive, what do you mean?
<zozozo>
flux: i don't follow you, what do you mean by 'dynamic' ?
<toolslive>
something like : exception 'a X (* akin to type 'a x = X of 'a *)
<zozozo>
indeed, you can't
bba has joined #ocaml
rgrinberg has joined #ocaml
<zozozo>
toolslive: however you can do : "type exn += Foo : 'a * ('a -> unit) -> exn"
solrize has quit [Ping timeout: 276 seconds]
lupine has joined #ocaml
<lupine>
hi. I was just wondering if anyone's built a vpn server on top of ocaml-tls yet ^^
NinjaTree has joined #ocaml
BitPuffin has joined #ocaml
solrize has joined #ocaml
solrize has quit [Changing host]
solrize has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dhil has joined #ocaml
bba has joined #ocaml
bba has quit [Client Quit]
kushal has quit [Read error: Connection reset by peer]
FreeBird_ has joined #ocaml
FreeBird_ has quit [Remote host closed the connection]
deavid has quit [Quit: No Ping reply in 180 seconds.]
FreeBirdLjj has quit [Ping timeout: 252 seconds]
hcarty has joined #ocaml
deavid has joined #ocaml
bba has joined #ocaml
<lupine>
literature review reveals no prior art, so onwards, I guess
<_y>
what does it cost exactly to pack/unpack a module into/from a first‐class value?
yegods has quit [Remote host closed the connection]
<ggole>
Allocates a record containing the values in the module.
yegods has joined #ocaml
* aggelos__
wonders if one can build ocaml-lua against luajit via opam
<_y>
ggole, ok, so that’s why giving the module signature is so crucial
dsheets has quit [Remote host closed the connection]
<_y>
hm, i guess then that unpacking a first‐class module is equivalent to dynamically build a module
<_y>
but how is a module (not a module‐as‐value) internally represented at runtime? is it a lookup table, or something comparable to a record whose shape is determined by its signature?
<aggelos__>
reynir: I'm aware, but afaict there's no opam package var to ask it to pick up luajit. currently pinning it locally
<reynir>
Oh sorry
tane has joined #ocaml
<aggelos__>
hmm
nicoo has quit [Ping timeout: 240 seconds]
<aggelos__>
not sure how to add a custom opam variable
<ggole>
_y: modules are pretty much records + some typing stuff
nicoo has joined #ocaml
<_y>
ggole, wouldn’t it mean that each time i supertype a module (« module A = let x = 42 end module B : sig end = A »), a new record has to be built?
<ggole>
Naively, yes
<ggole>
Of course the optimiser can remove some of that in some circumstances
<aggelos__>
hmm
<aggelos__>
linking against libluajit resulted in a segfault
<aggelos__>
at runtime I mean
<ggole>
The way functors and module coercions are compiled is that a new module is allocated and filled in with values in the order of the module type
<_y>
i guessed so
<_y>
oh, but it also means that changing the order of values in a signature (e·g· between a functor parameter and the actual argument given) results in additional module constructions :/
<_y>
well, anyway in such a situation it is likely that the functor requires only a small subset of the module given
<zozozo>
hopefully flambda can inline most top-level functor applications
luzie has quit [Ping timeout: 246 seconds]
<ggole>
If you want to use the same names in different positions, as module typing lets you do, then you either need to copy a new module or have some kind of index
<ggole>
There's a cost either way
<ggole>
Since module accesses are (much) more prevalent than modules constructions, the choice is pretty obvious
sh0t has joined #ocaml
luzie has joined #ocaml
madroach has quit [Ping timeout: 244 seconds]
<_y>
fair enough
jrslepak_ is now known as jrslepak
whitequark has left #ocaml [#ocaml]
<_y>
specifically, i was wondering what would be the overhead of modular implicits
<pierpa>
aren't they a compile time device?
mistermetaphor has joined #ocaml
<_y>
i guess than inlining eliminates most of it
<_y>
pierpa, they are translated into the core module system
<pierpa>
hmmm
<_y>
by passing a first‐class‐module argument to the function
<pierpa>
ok
myst|fon has quit [Quit: Connection closed for inactivity]
<_y>
(actually no, for typing purposes the function is translated to a functor, which has to be packed/unpacked, but that’s the same idea)
Mercuria2Alchemi has quit [Ping timeout: 260 seconds]
madroach has joined #ocaml
lokien_ has quit [Quit: Connection closed for inactivity]
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
copy` has joined #ocaml
thomasga has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
vbmithr has quit [Ping timeout: 276 seconds]
seangrove has joined #ocaml
vbmithr has joined #ocaml
yegods has quit [Remote host closed the connection]
<toolslive>
can opam work with git submodules?
<thomasga>
nope
<toolslive>
can I workaround via a depext on git and some cli stuff in the "build" section?
<thomasga>
do you want submodules for pinning?
<toolslive>
no, I need a to init, and update the submodules before the package can be build
<toolslive>
I'm using the url "git:" flavour iso an archive
noddy has joined #ocaml
bba has joined #ocaml
<thomasga>
maybe add a command in the `build` section?
<thomasga>
hum, if you want to submit to the main opam repo, it's better to use an archive instead of a Git repo (with submodules)
freehck has quit [Ping timeout: 260 seconds]
rgrinberg has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bba has joined #ocaml
bba has quit [Client Quit]
bba has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
pierpa` has joined #ocaml
<zaquest>
why `type some_type = int * string list with sexp;;` gives me `Error: Parse error: [str_item] or ";;" expected (in [top_phrase])`? is it because i dont have #require "ppx_jane";; in my .ocamlinit? if so how do i have it, #require "ppx_jane";; gives me error http://pastebin.com/chn44km4
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<zaquest>
im following real world ocaml
<zaquest>
that thing earlier in the book with <:sexp_of<some type>> didnt work too
<zozozo>
zaquest: I think the sintax "type foo = ... with sexp" is a camlp4 syntax
<zaquest>
i have #camlp4o in .ocamlinit
<zozozo>
with ppx it would look like "type t = ... [@foobar]" with the correct foobar of course
pierpa has quit [Ping timeout: 252 seconds]
dsheets has quit [Remote host closed the connection]
dsheets has joined #ocaml
<zaquest>
there were problems with camlp4 though, i had to install it from the system's repository because when i installed it with opam it lacked some binaries camlp4o.opt iirc and because of that some other packages failed to build
<zozozo>
but I don't know janestreet's ppx so I can't help you much, :p
<zaquest>
i thought that it might be ppx_jane because i have everything else from installation instructions for RWO
bba has joined #ocaml
octachron has joined #ocaml
<octachron>
zaquest, ppx and camp4 extensions are incompatible
NinjaTree has quit [Remote host closed the connection]
<toolslive>
there are some other packages that install from a git tag.
<toolslive>
I honestly don't see why an archive would be better.
<octachron>
zaquest, yes, it is wrong. The described setting cannot work.
boegel has quit [Remote host closed the connection]
<octachron>
you can either use janestreet camlp4 extensions, which are used in RWO, or the ppx ones but not both: #camlp4o + #require "ppx_jane" is an error
boegel has joined #ocaml
<zaquest>
octachron, so how can i get `with sexp` thing? and <:sexp_of<..>>
dsheets has quit [Remote host closed the connection]
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<rgrinberg>
[@@deriving sexp] and [%sexp_of: ...] respectively
<rgrinberg>
if you want to use the ppx extensions in the top level use #require "ppx_deriving"
<rgrinberg>
ppx_jane is a standalone preprocessor I believe
<octachron>
rgrinberg, ppx_jane is equivalent to applying the whole set of janestreet's ppx extensions
thomasga has quit [Quit: Leaving.]
<rgrinberg>
octachron: yes, but in a standlone preprocessor no?
<rgrinberg>
to use with -pp. not sure how you'd use that from the toplevel
<rgrinberg>
I did forget to tell you to also do #require "ppx_sexp_conv";;
<rgrinberg>
and #require "core";;. and make sure to do open Core.Std;; before calling any derivers as well >_<
<zaquest>
rgrinberg, works, thank you
<rgrinberg>
zaquest: if you're going to use other deriving plugins, make sure to require them as well
<rgrinberg>
otherwise ppx_deriving will complain about missing derivers
lokien_ has joined #ocaml
<zaquest>
i also had to remove #camlp4o;;
<octachron>
rgrinberg, ppx_jane can act as both a pp preprocessor or a ppx one
<rgrinberg>
zaquest: yup. you should never really use that line.
<rgrinberg>
octachron: ok cool, wasn't aware.
<zaquest>
now i hope that other `with` things (like `with type <sometype> = <othertype>` thing in functors) arent just camlp4 syntax too :D
<_y>
nope
<rgrinberg>
no, that's OCaml
octachron_ has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
NinjaTree has joined #ocaml
NinjaTree has left #ocaml [#ocaml]
IntTree has joined #ocaml
octachron has quit [Ping timeout: 250 seconds]
struktured has joined #ocaml
larhat has quit [Quit: Leaving.]
Denommus has joined #ocaml
darkf has quit [Quit: Leaving]
struktured has quit [Ping timeout: 244 seconds]
dsheets has joined #ocaml
kushal has quit [Quit: Leaving]
kdas_ has joined #ocaml
kdas_ is now known as kushal
kushal has quit [Changing host]
kushal has joined #ocaml
Algebr has quit [Remote host closed the connection]
Algebr has joined #ocaml
slash^ has joined #ocaml
Algebr has quit [Ping timeout: 250 seconds]
dhil has quit [Ping timeout: 250 seconds]
kushal has quit [Ping timeout: 246 seconds]
kushal has joined #ocaml
bba has joined #ocaml
octachron_ has quit [Quit: Page closed]
thibm has joined #ocaml
rgrinberg has quit [Ping timeout: 260 seconds]
ggole has quit []
copy` has quit [Quit: Connection closed for inactivity]
rgrinberg has joined #ocaml
dsheets_ has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
Algebr has joined #ocaml
dsheets_ has quit [Remote host closed the connection]
noddy has quit [Ping timeout: 252 seconds]
copy` has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bba has joined #ocaml
bba has quit [Read error: Connection reset by peer]
govg has quit [Ping timeout: 250 seconds]
kushal has quit [Ping timeout: 246 seconds]
oskarth has joined #ocaml
tane has joined #ocaml
slash_ has joined #ocaml
kushal has joined #ocaml
kakadu has quit [Quit: Page closed]
solrize has quit [Ping timeout: 276 seconds]
bba has joined #ocaml
octachron has joined #ocaml
Algebr` has joined #ocaml
octachron has quit [Ping timeout: 244 seconds]
badon_ has joined #ocaml
badon has quit [Disconnected by services]
Algebr has quit [Remote host closed the connection]
badon_ is now known as badon
octachron has joined #ocaml
TheLemonMan has joined #ocaml
dsheets has joined #ocaml
zaquest has quit [Read error: Connection reset by peer]
zaquest has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
octachron has quit [Read error: Connection reset by peer]
dsheets has joined #ocaml
slash_ has quit [Read error: Connection reset by peer]
slash^ has quit [Read error: Connection reset by peer]
ril has joined #ocaml
BitPuffin has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 250 seconds]
kakadu has joined #ocaml
octachron has joined #ocaml
yegods has joined #ocaml
natimic has quit [Remote host closed the connection]
natimic has joined #ocaml
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 240 seconds]
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 265 seconds]
dsheets has joined #ocaml
mistermetaphor has quit [Remote host closed the connection]
dsheets has quit [Read error: Connection reset by peer]
noddy has joined #ocaml
dsheets has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oskarth has quit [Quit: Connection closed for inactivity]
tane has quit [Ping timeout: 260 seconds]
dsheets has quit [Ping timeout: 276 seconds]
kushal has quit [Ping timeout: 260 seconds]
tane has joined #ocaml
<tizoc>
rgrinberg: hey, did anything change in how stuff that depends on opium has to be compiled in the new version? (using ocamlbuild), for some reason it can't find Opium_app and Opium (but merlin does)
dsheets has joined #ocaml
AlexRussia has joined #ocaml
nicholasf has joined #ocaml
mistermetaphor has joined #ocaml
bba has joined #ocaml
<tizoc>
ahhh there is opium.unix now
<tizoc>
it built fine after adding that to the package list
dsheets has quit [Ping timeout: 250 seconds]
<companion_cube>
fun, I just sent a PR to update thr readme
<rgrinberg>
tizoc: yeah I renamed some findlib packages after factoring out the unix stuff
mistermetaphor has quit [Ping timeout: 260 seconds]
<tizoc>
I see that the dependency on core_kernel is gone, thats cool
<tizoc>
I was using some of the core_kernel stuff because I already depended on it through opium, but I can probably switch away from it now and get smaller binaries
<rgrinberg>
thank companion_cube for that :P
<companion_cube>
^^
dsheets has joined #ocaml
mistermetaphor has joined #ocaml
dsheets has quit [Ping timeout: 250 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
dsheets has joined #ocaml
nicholasf has quit [Remote host closed the connection]
dsheets has quit [Ping timeout: 246 seconds]
deocmivi has joined #ocaml
octachron_ has joined #ocaml
octachron has quit [Ping timeout: 276 seconds]
dsheets has joined #ocaml
octachron_ has quit [Client Quit]
dsheets has quit [Ping timeout: 240 seconds]
hcarty has quit [Ping timeout: 276 seconds]
noddy has quit [Ping timeout: 250 seconds]
dsheets has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
copy` has quit [Quit: Connection closed for inactivity]
jeffmo has quit [Quit: jeffmo]
dsheets has joined #ocaml
IntTree has quit [Quit: Leaving.]
dsheets has quit [Ping timeout: 246 seconds]
dsheets has joined #ocaml
ril has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dsheets has quit [Ping timeout: 246 seconds]
noddy has joined #ocaml
bba has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dsheets has joined #ocaml
d0nn1e has quit [Ping timeout: 250 seconds]
d0nn1e has joined #ocaml
dsheets has quit [Ping timeout: 276 seconds]
lokien_ has quit [Quit: Connection closed for inactivity]
amnn_ has joined #ocaml
kakadu has quit [Remote host closed the connection]
amnn has quit [Ping timeout: 252 seconds]
silver_ has joined #ocaml
silver has quit [Ping timeout: 244 seconds]
silver_ has quit [Client Quit]
<seliopou>
aantron: yo
<seliopou>
what's the situation here?
<aantron>
seliopou: hi :)
<aantron>
where, in the PR?
<aantron>
or IRC? :)
<seliopou>
yeah I think I'm missing somethign here
<seliopou>
or there, as it were
<seliopou>
a clone does not lead to any memory blowup
<seliopou>
it creates a new, single spine
<aantron>
the clone itself doesn't
<aantron>
im just using the two clones to force the spine to be retained in memory without the possiblity of collecting "earlier" nodes
<seliopou>
right but that's no worse than the lazy case
<aantron>
well, that is the lazy case
<aantron>
it leads to a memory error eventually, during reading
<seliopou>
how?
<aantron>
when you allocate enough nodes in the spine
<aantron>
AFAICT you need to allocate the stream nodes to hold the references to the data
<seliopou>
that's correct
<aantron>
and since the other clone is holding the reference to the beginning of the queue, you cant release them as the first clone is advanced
dsheets has joined #ocaml
<seliopou>
yes, that is the same both before and after the pr
nicholasf has joined #ocaml
<aantron>
yes, what i am saying is that we shouldnt mark the stream closed
<seliopou>
why is that?
<seliopou>
because of that?
<seliopou>
(I'm a bit confused, so bear with me)
<aantron>
yes, because this is different from a stream that was actually successfully read to the end
<aantron>
because in the case of reading to the end, you already have the queue, or some suffix of it, allocated
<aantron>
(in async, of_list eagerly allocates the whole spine, so its equivalent to lwt using of_list, followed by the peeks you suggested, which would then trip the closed state, giving equivalent behavior)
<aantron>
which is actually what i was going to recommend in a comment for your use-case, which i dont know
dsheets has quit [Ping timeout: 276 seconds]
<aantron>
but it seemed like a bit of a presumption
<aantron>
and there is use in knowing which side effects cannot occur if you access a stream
solrize has joined #ocaml
solrize has quit [Changing host]
solrize has joined #ocaml
<seliopou>
ok so your and mine understanding of pipe and lwt_stream semantics seem to agree
<seliopou>
what we disagree about is what being closed means
<seliopou>
for me, being closed meas that the stream won't _receive_ any more elements than it already has
<aantron>
seems like it
<aantron>
im not sure how you can make use of that, in a sense thats relevant to this discussion
<seliopou>
it's very relevant
<aantron>
and another thing im concerned with is whether this is an implication or an equivalence
<seliopou>
what do you mean?
<aantron>
like, if a stream won't receive any more elements than it already has, does that mean that it is closed?
<seliopou>
yes
<aantron>
i dont think we can achieve this equivalence though
dsheets has joined #ocaml
<seliopou>
and that's important because of blocking
<seliopou>
a closed stream won't block any more
<aantron>
we can only achieve "if a stream is closed, it won't receive any more elements than it has"
<aantron>
yes
<aantron>
im also concerned with what it means for a stream to "have" an element
<aantron>
like, if a stream has an element, should you be able to read it?
<seliopou>
without blocking?
<seliopou>
(this is all about blocking, by the way)
<aantron>
yes
<seliopou>
then the answer is no
<seliopou>
if it's closed, then you don't have to block to read
<seliopou>
if it's not closed, all bets are off
<aantron>
but then from_direct should also result in closed streams, right?
<seliopou>
no because it may not terminate
<aantron>
ok so its blocking and termination, but why not memory errors?
<seliopou>
it can be an infinite stream
<seliopou>
memory errors?
<seliopou>
you mean allocating memory?
<aantron>
if you have a lazy stream, it could be that reading it would not block, and would terminate, but we cannot allocate the spine node
<aantron>
yes
<seliopou>
i've never known a library to make those sorts of claims
<aantron>
what claims?
<seliopou>
"you will never hit an OOM calling this function"
<seliopou>
I've known them to say "this will allocate O(f(x)) memory"
dsheets has quit [Ping timeout: 276 seconds]
<aantron>
and i dont intend to add it to lwt :)
<aantron>
im just trying to see why you pick a certain set of side effects
<seliopou>
divergence is a pretty standard side effect
<aantron>
and want closed to mean that those wont happen
<seliopou>
that and exceptions, and io
<aantron>
as is memory handling
<seliopou>
not really
<aantron>
and i dont know of a library right now that claims a stream is closed when the spine is not allocated and the end reached
<seliopou>
wait what?
<seliopou>
ok we may have to back up, because that's not what i'm proposing, and that's not what the code does
<seliopou>
spine's allocated
<seliopou>
for sure
<aantron>
ok actually let me take a harder look :p
<aantron>
alright. i assumed we had settled that you werent doing this
noddy has quit [Ping timeout: 260 seconds]
<aantron>
fair enough, however
thibm has left #ocaml ["WeeChat 1.4"]
<seliopou>
just commented the line
<aantron>
yes, i saw it
<aantron>
okay that settles the delayed side effects
<seliopou>
That is, by the way, my first ever use of a while loop in ocaml
<aantron>
but then the issue is why change to this
<aantron>
hehe
dsheets has joined #ocaml
<seliopou>
"if closed, then no blocking"
<aantron>
i mean, to an eager implementation?
<seliopou>
i don't really view it as eager
<seliopou>
it's just storing the list in the stream's queue
<seliopou>
the elements are computed
<seliopou>
so i view it more as calling a spade a spade
IntTree has joined #ocaml
<aantron>
im not sure what you mean by that
<aantron>
(spade a spade)
<seliopou>
sorry, colloquialism
<aantron>
but it still seems a bit off, see comment
<seliopou>
I think it's incorrect to call the previous behavior lazy because all the elements have already been computed
<aantron>
it's lazy because the call of_list does little
<aantron>
it now does much more
<seliopou>
it's true that this does more work, and allocates more memory
<seliopou>
I don't think it does much more
<seliopou>
it allocates O(n) memory
<aantron>
as compared to O(1) though
<seliopou>
yep
dsheets has quit [Ping timeout: 276 seconds]
<seliopou>
I don't think that should get in the way of implementing the right semantics
<aantron>
like i am suggesting, why not provide a function that can "close" a stream by peeking the whole thing
<aantron>
but its not clear that these are the right semantics. every other stream is "lazy", many because they have to be
<seliopou>
(this module is already a bit of a mess, and I'm trying to improve it, not make it worse)
<aantron>
i think keeping it uniform is a good way not to make it worse
<aantron>
its not clear to me that constructing a stream from a list should read the whole list, while constructing a stream from a function that reads a list should do almost nothing
<seliopou>
why do you view it as "reading" a list?
<seliopou>
the list, after all, is there.
<aantron>
well change it to the spine of a list
<aantron>
its there in both cases, but the behavior is different
<aantron>
perhaps before i speak too much i should double chck there isnt such a function already
<seliopou>
there isn't
<seliopou>
it's why i went to the trouble of implemeting the pr
<aantron>
right
<seliopou>
ok new perspective: you're writing a library, and that library has a function that recieves a stream as an argument
<aantron>
but it seems better to me, that the part where you pre-load the spine, should be part of the API, and not be baked into of_list, of_array, and of_string
<seliopou>
so you're not constructing these things any more, you're consuming them
<seliopou>
that means that if the stream was constructed with a list, you don't know what its length was
<seliopou>
(this is my perspective when authoring the pr, btw.)
dsheets has joined #ocaml
<aantron>
yes, ..but?
<aantron>
or and :)
<seliopou>
there is no way to discover the blocking behavior of the stream that's being recieved without these changes
<seliopou>
granted, some from_directs may never block, there you can't do much better
<seliopou>
but if somebody's just feeding a fixed length stream to you, it'd be good to know that
<aantron>
yes, so what im saying is, if the producer wants to create a stream from a list and have it be closed, the producer does "of_list l |> peek_the_whole_thing"
<seliopou>
in the case of, for example, cohttp
rgrinberg has quit [Ping timeout: 265 seconds]
<seliopou>
that assumes your users are "well-informed"
<seliopou>
:P
<seliopou>
also, you don't want to do that for all "from_direct" streams
<aantron>
sure, they have to be a bit well-informed :) but, 2 things
<seliopou>
so that means yet another variant for the source
<aantron>
wait
<seliopou>
we're up to what 6 now?
<aantron>
what other variant/
<seliopou>
type 'a source = From_direct | ... etc.
dsheets has quit [Ping timeout: 240 seconds]
<aantron>
im suggesting not adding any new variants, but a function that takes an existing stream and peeks it until stream end
<seliopou>
yeah and if from_direct is infinite, you're hosed
<aantron>
yes
<aantron>
which is why my example was with of_list
<aantron>
im not suggesting this for the consumer
<seliopou>
this seems like a really error-prone solution
<aantron>
can you describe a scenario?
<seliopou>
I don't see how this is more desirable than closing a stream that's known to be finitie upon construction
<seliopou>
doing that benefits creators and consumers
tane has quit [Quit: Verlassend]
<seliopou>
whereas this doesn't help consumers, and hopes that creators use it properly
<aantron>
perhaps it is desirable to bake this into of_list, performance penalty be damned, but it should also be available outside the 3 blessed functions
<seliopou>
ehhh list is the universal interface? :D
<seliopou>
;)
<aantron>
meaning, copy spine to list spine, then copy to stream spine, then you get a closed stream? :)
<seliopou>
wait wait
<seliopou>
ohhhh
<seliopou>
I got your covered
<seliopou>
you just use Lwt_stream.create ()
<seliopou>
hah, forgot about that
<seliopou>
the push function will enqueue elements
<aantron>
it is not the only way to achieve this
<aantron>
but yes
<seliopou>
So maybe something like this (modulo name, but look at the type): make : ('a -> unit) -> 'a t
<seliopou>
wait scratch that
<seliopou>
make : (('a -> unit) -> unit) -> 'a t
<seliopou>
there we go
<aantron>
lol
<seliopou>
what?? :P
<aantron>
this is literally the markup.ml cps stream in my existing project
<aantron>
anyway
<seliopou>
it's also the Pipe.t interface :)
<aantron>
yeah, now i know what i got myself into :p
<aantron>
with the stream interface
<aantron>
how about, can you tell me more about the use case? where are the closed streams important?
<seliopou>
determining the body encoding of an http resposne
<seliopou>
if it's all there, you can use fixed. if it's not you have to chunk
dsheets has joined #ocaml
<seliopou>
using the current interface means that you have to read the whole stream into memory
<aantron>
is it possible to use get_available and is_closed together somehow?
madroach has quit [Ping timeout: 244 seconds]
<seliopou>
i don't think so
<aantron>
another thing i was consider during this PR, is you might just need some flag "this was constructed from a fixed length source that is in memory" or qhatever
<aantron>
it seems a bit off to require a full pre-read for all users, just to convey this information
<aantron>
pre-read of the spine
<seliopou>
i duno
<aantron>
i think its clear we are talking about spines from context when we are, so i will use it loosely
<seliopou>
for my use-case the spine is tiny relative to the size of the elements
<aantron>
right
<aantron>
but i dont think thats always the case
<seliopou>
yeah for sure
madroach has joined #ocaml
<aantron>
in particular iirc there are some char streams somewhere in lwt_io, let me look
<seliopou>
if my reading of get_available is correct, it won't do it
<aantron>
obviousl that particular stream won't get "pre-loaded"
<seliopou>
right
<seliopou>
still not the best idea tho :/
<aantron>
but if someone is constructing alternatives to pass to some function that expects these things, and makes one from a string, then there is potential trouble
<aantron>
i agree
<seliopou>
so you're talking about the of_string constructor?
<aantron>
right now yes
bba has joined #ocaml
<seliopou>
to be frank, i'd just get rid of of_string
<seliopou>
but that's just me, i acknowledge
mabino-pyon has quit [Quit: brb]
copy` has joined #ocaml
<aantron>
also, going back to the option of leaving of_list "lazy", but adding a pre-loading function, how would a user that is producing such a thing get this wrong, more wrong than producing a blocking stream, for example
<aantron>
?
rgrinberg has joined #ocaml
<seliopou>
but also, that's just like a haskell list and they seem to get on fine :P
<aantron>
hehe
<seliopou>
pre-loading function?
<aantron>
yeah some simple helper that forces the spine to be loaded
<aantron>
feed_direct i guess :)
<aantron>
err no
<aantron>
from_fixed
<aantron>
suitably modified
dsheets has joined #ocaml
<seliopou>
yeah so handing it a generator function is not sufficient
<seliopou>
the Writer.t is essentially the push function
<seliopou>
1 sec as i write pseudocode
<aantron>
i dont see why it needs a length, i mean a function that takes a constructed stream and tries to peek it without blocking until it reaches None
<seliopou>
so it would be: for i upto cutoff; do npeek i stream; done
<seliopou>
gotta specify cutoff, or just define it as a constant
<seliopou>
actually it could just be `npeek cutoff stream`;
dsheets has quit [Ping timeout: 260 seconds]
<aantron>
or even of_list ~eager:true
<aantron>
or make eager the default, and make lazy an option
<seliopou>
that
seangrove has quit [Ping timeout: 246 seconds]
<seliopou>
it would be a comprompise
<seliopou>
but that seems like an interface that's growing hairs
<aantron>
as for the cutoff in the "loader" function, i dont think its necessary. we just state "this is intended for use during stream construction. if you apply it to an infinite stream, it will loop forever"
<aantron>
but make does seem like probably a better idea :)
Sim_n has joined #ocaml
<seliopou>
wow that gist was super-wrong but had the right shape
<seliopou>
updated it
<seliopou>
yeah make is the nicely-packaged way of doing what of_list etc does
<seliopou>
which is possible now using create ()
Sim_n has quit [Client Quit]
<aantron>
this is why i think this should be a separate issue/PR :)
<aantron>
it seems way harder/controversial than closed/is_closed
<aantron>
+more*
<seliopou>
separate pr or not we're having the discussion so we should try and reach a conlusion
<seliopou>
things can be shuffled later for merging
<aantron>
of course
Simn has quit [Ping timeout: 260 seconds]
<aantron>
just commenting
<seliopou>
yeah
<seliopou>
understood
deocmivi has left #ocaml ["Konversation terminated!"]
pyon has joined #ocaml
<seliopou>
so basically your view is that closing finite things is not a bad thing in principle but should have a general interface