keen__________21 has quit [Ping timeout: 260 seconds]
alexst has quit [Ping timeout: 256 seconds]
igoroliveira has joined #ocaml
tennix has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
BitPuffin|osx has quit [Ping timeout: 264 seconds]
ollehar has quit [Remote host closed the connection]
jeffmo has quit [Quit: jeffmo]
uu has joined #ocaml
browncodes has quit [Ping timeout: 264 seconds]
samrat has joined #ocaml
damason has joined #ocaml
alexst has joined #ocaml
tnguyen has quit [Read error: Connection reset by peer]
alexst has quit [Ping timeout: 252 seconds]
tnguyen has joined #ocaml
mac10688 has quit [Ping timeout: 265 seconds]
manizzle has quit [Ping timeout: 246 seconds]
tmtwd has joined #ocaml
segmond has joined #ocaml
tmtwd has quit [Ping timeout: 250 seconds]
browncodes has joined #ocaml
mcclurmc has joined #ocaml
tennix has quit [Quit: WeeChat 1.3]
igoroliveira has quit [Quit: Connection closed for inactivity]
MercurialAlchemi has joined #ocaml
mcclurmc_ has joined #ocaml
mcclurmc has quit [Ping timeout: 256 seconds]
darkf has joined #ocaml
shinnya has quit [Ping timeout: 264 seconds]
samrat has quit [Ping timeout: 250 seconds]
kalzz has quit [Ping timeout: 252 seconds]
kalzz has joined #ocaml
obadz has quit [Ping timeout: 240 seconds]
obadz has joined #ocaml
xikuuky has joined #ocaml
samrat has joined #ocaml
AltGr has joined #ocaml
xikuuky has quit [Quit: leaving]
MercurialAlchemi has quit [Ping timeout: 244 seconds]
huza has joined #ocaml
AltGr has left #ocaml [#ocaml]
mcclurmc_ has quit [Remote host closed the connection]
slash^ has joined #ocaml
damason has quit [Ping timeout: 255 seconds]
huza has quit [Quit: WeeChat 0.3.8]
Haudegen has quit [Ping timeout: 252 seconds]
Haudegen has joined #ocaml
ely-se has joined #ocaml
LnL has joined #ocaml
Submarine has joined #ocaml
antkong has quit [Quit: antkong]
rgrinberg has quit [Ping timeout: 244 seconds]
AlexRussia has quit [Remote host closed the connection]
sh0t has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 244 seconds]
browncodes has quit [Remote host closed the connection]
ely-se has quit [Quit: leaving]
rgrinberg has joined #ocaml
ely-se has joined #ocaml
sh0t has quit [Ping timeout: 272 seconds]
browncodes has joined #ocaml
rgrinberg has quit [Ping timeout: 255 seconds]
ely-se has quit [Quit: leaving]
browncodes has quit [Remote host closed the connection]
freehck has joined #ocaml
<freehck>
good ugt morning everybody
cthuluh has quit [Ping timeout: 246 seconds]
<reynir>
morning freehck
larhat has quit [Read error: Connection reset by peer]
zorun has joined #ocaml
samrat has quit [Ping timeout: 240 seconds]
octachron has joined #ocaml
larhat has joined #ocaml
cthuluh has joined #ocaml
Kakadu has joined #ocaml
freehck has quit [Ping timeout: 246 seconds]
k1000 has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
ygrek has joined #ocaml
ygrek has quit [Read error: Connection timed out]
ygrek has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
magthe has joined #ocaml
<magthe>
is it possible to use oasis to build out-of-source?
<magthe>
my little project builds fine in the source dir (oasis setup && ocaml setup.ml -configure && ocaml setup.ml -build)
<magthe>
but I can't seem to get it to build in a separate build dir: mkdir _build && cd _build && oasis setup -oasis ../_oasis && ocaml setup.ml -C .. -configure && ocaml -C .. setup.ml -bild
<mrvn>
it always builds out of source, just not where you want it
<magthe>
the former succeeds, the latter doesn't
<magthe>
mrvn: yes, exactly... I want some control over it so I can plug it into another build system more cleanly
<mrvn>
oehm, my oasis already uses _build
<magthe>
mrvn: yes, but `oasis setup` litters the folder with generated stuff
<magthe>
I want *all* such things out of the way
<mrvn>
magthe: afaik not supported
<magthe>
and in the end I want to move the build to something like ${project_top_dir}/build/src/myproject/
<mrvn>
oasis build process also just copies all your source to _build. It doesn't truely support out-of-source building.
<magthe>
mrvn: but then it really *ought* to support it
<mrvn>
patches welcome :)
<magthe>
mrvn: I see a very specific issue, so I'll see if I can create a minimal example first :)
<johnelse>
"oasis setup -setup-update dynamic" creates a *lot* less autogenerated stuff
<johnelse>
you might be able to move the files it does generate to a subdirectory
<mrvn>
more importantly it doesn't mix generated and not generated content in the same file.
ely-se has joined #ocaml
ely-se has quit [Client Quit]
samrat has joined #ocaml
xiaolin has joined #ocaml
darkf_ is now known as darkf
ely-se has joined #ocaml
ely-se has quit [Client Quit]
ely-se has joined #ocaml
ely-se has quit [Client Quit]
Haudegen has quit [Ping timeout: 240 seconds]
ely-se has joined #ocaml
johnelse has quit [Quit: leaving]
Kakadu has quit [Ping timeout: 246 seconds]
ely-se has quit [Quit: leaving]
Haudegen has joined #ocaml
octachron has quit [Ping timeout: 250 seconds]
rand__ has joined #ocaml
johnelse has joined #ocaml
johnelse is now known as Guest74702
Guest74702 is now known as johnelse
ely-se has joined #ocaml
larhat has quit [Ping timeout: 256 seconds]
<magthe>
johnelse: I can generate them in a subdir directly... but `setup -build` fails
ygrek has quit [Ping timeout: 246 seconds]
ontologiae has joined #ocaml
ygrek has joined #ocaml
mort___ has joined #ocaml
ollehar has joined #ocaml
mort___ has quit [Read error: Connection reset by peer]
mort___1 has joined #ocaml
sepp2k has joined #ocaml
ontologiae has quit [Ping timeout: 260 seconds]
mort___ has joined #ocaml
browncodes has joined #ocaml
mort___1 has quit [Ping timeout: 260 seconds]
magthe has left #ocaml ["WeeChat 1.3"]
<ely-se>
I think a dialect of OCaml focussed on concurrency should be called occam-l
larhat has joined #ocaml
jao has joined #ocaml
octachron has joined #ocaml
samrat has quit [Ping timeout: 264 seconds]
_andre has joined #ocaml
browncodes has quit [Remote host closed the connection]
Simn has joined #ocaml
alexst has joined #ocaml
<cthuluh>
hmm, https://forge.ocamlcore.org/ is slow to send me an email so that I can confirm my account creation
<cthuluh>
is there someone here related to the forge?
<adrien>
it's been mostly gildor's doing but he's not around at the moment it seem
<adrien>
s
<adrien>
apparently being a dad is not very compatible with being a sysadmin (but as far as I understand, the services from the forge may get some more people to maintain them)
<cthuluh>
I see
samrat has joined #ocaml
Submarine has quit [Remote host closed the connection]
<adrien>
and when you say "slow", it's been already more than ten minutes I guess, right?
browncodes has joined #ocaml
<cthuluh>
30+mn, keeping an eye on mail.log
<adrien>
probably better to send a mail on the caml-list
browncodes has quit [Remote host closed the connection]
mort___ has quit [Quit: Leaving.]
<adrien>
cthuluh: you won't get notifications though
<cthuluh>
maybe I don't need to submit a report, actually ;)
<adrien>
cthuluh: I managed to find my credentials again so now you either do it yourself or give me the text content :P
BitPuffin|osx has joined #ocaml
Submarine has joined #ocaml
antkong has joined #ocaml
jeffmo has joined #ocaml
<cthuluh>
adrien: actually I'm being serious, the feature request would probably be useless now
<adrien>
why?
<cthuluh>
well, because the feature has been implemented. gotta test it
<cthuluh>
I'd still like an account on the forge, though ;)
<adrien>
haha :)
<adrien>
mail the caml-list
samrat has quit [Ping timeout: 246 seconds]
nullcatxxx_ has joined #ocaml
jeffmo has quit [Read error: Connection reset by peer]
jeffmo has joined #ocaml
ontologiae has joined #ocaml
nullcatxxx_ has quit [Client Quit]
mort___ has joined #ocaml
nullcatxxx_ has joined #ocaml
obadz- has joined #ocaml
obadz has quit [Ping timeout: 264 seconds]
ontologiae has quit [Ping timeout: 244 seconds]
native_killer has joined #ocaml
obadz- has quit [Ping timeout: 265 seconds]
obadz has joined #ocaml
ely-se has quit [Quit: leaving]
tmtwd has joined #ocaml
ely-se has joined #ocaml
mort___1 has joined #ocaml
mort___1 has left #ocaml [#ocaml]
mort___ has quit [Ping timeout: 265 seconds]
Kakadu has joined #ocaml
ely-se has quit [Quit: leaving]
ontologiae has joined #ocaml
Haudegen has quit [Ping timeout: 252 seconds]
xet7 has joined #ocaml
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rgrinberg has joined #ocaml
nullcatxxx_ has joined #ocaml
jbrown has quit [Ping timeout: 246 seconds]
ely-se has joined #ocaml
ely-se has quit [Client Quit]
native_killer has quit [Ping timeout: 244 seconds]
jbrown has joined #ocaml
ontologiae has quit [Ping timeout: 272 seconds]
Haudegen has joined #ocaml
native_killer has joined #ocaml
ely-se has joined #ocaml
cago has joined #ocaml
cago has quit [Client Quit]
antkong has quit [Quit: antkong]
cthuluh has quit [Remote host closed the connection]
cthuluh has joined #ocaml
ely-se has quit [Quit: leaving]
samrat has joined #ocaml
ontologiae has joined #ocaml
Kakadu has quit [Ping timeout: 246 seconds]
tmtwd has quit [Ping timeout: 264 seconds]
damjan has joined #ocaml
<damjan>
hi all, I'd like to start learning ocaml, and wanted to give myself a concrete goal (ie. to write some kind of a xmpp component for a jabber server) - can someone point me to a good xmpp library that I can use?
<damjan>
haesbaert: that's a whole client, I need a library. he uses https://github.com/hannesm/xmpp but I can't find any docs about it
<hannes>
damjan: this xmpp library is not good imho..
<hannes>
damjan: it'd be great to start from scratch using xmlm and uutf (libraries from buenzli)
<damjan>
I'll take a look
jeffmo has quit [Quit: jeffmo]
mort___ has quit [Ping timeout: 252 seconds]
travisbrady has joined #ocaml
mort___ has joined #ocaml
k1000 has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
ely-se has joined #ocaml
rgrinberg has quit [Ping timeout: 252 seconds]
ely-se has quit [Client Quit]
ggole has joined #ocaml
ely-se has joined #ocaml
<ollehar>
yet another question about gc and reallocating custom blocks.
rgrinberg has joined #ocaml
<ollehar>
say I have a custom block/value pointing to a char*
jeffmo has joined #ocaml
<ollehar>
can I change the value to point to another char* and manually freeing the original char*?
<ollehar>
but if I do realloc the two char*'s can overlap! so what's the correct behaviour?
samrat has quit [Ping timeout: 265 seconds]
MercurialAlchemi has joined #ocaml
<ollehar>
hm
<ely-se>
malloc, memcpy, free will never overlap
<ely-se>
but is behaviorally equivalent to realloc
<enjolras_>
realloc is usually more clever than that, but semantically yes
tane has joined #ocaml
<ollehar>
ely-se: yeah, the point was to optimise using realloc instead of malloc
<enjolras_>
to be honest, most realloc implementations are quite dumb so no point over optimizing ecause it works for them
<enjolras_>
you have to use complex malloc implementation like jemalloc to have clever realloc
<enjolras_>
if your chunk of memory is really huge (like, in MB) you can optimize on linux with mremap
<enjolras_>
but messing with the page table only worths it for very big chunks
<flux>
damjan, but who wants xmpp these days? matrix looks much nicer ;-)
<ollehar>
Enjolras_: hm hm hm, I'll just try to implement a buffer instead then
<flux>
(matrix ocaml client/server library would be cool to have)
zol has joined #ocaml
* zol
has joined the herd!
<ely-se>
flux: matrix is not very good
<zol>
Are there any other micro web frameworks other than Opium?
beginner has quit [Ping timeout: 246 seconds]
<ely-se>
because people will constantly try to hack into the matrix
<flux>
ely-se, darn, I had high hopes. well, xmpp it is then
<flux>
actually I'm hoping matrix might eventually replace irc..
travisbrady has quit [Quit: travisbrady]
<enjolras_>
matrix sounds much more limited that xmpp
<ely-se>
it wont'
<flux>
enjolras_, in what sense?
<enjolras_>
it's just a chat protcol with p2p video for now, afaik
<ely-se>
unless maybe freenode, rizon etc start offering it with superb IRC interop
<enjolras_>
xmpp benefits from a lot of XEP which have been well studied for years
<flux>
well, you can transfer other data in it, in fact one goal of it is to provide interdevice communication (all praise IoT!)
<enjolras_>
i mean, even if xmpp is not really used in the wild, it has a lot of features avaible already
<damjan>
flux: I use irc over xmpp on my phone, cause it supports session(or stream) resumption
<enjolras_>
for privacy, to adapt to mobile networks, for microblogging, etc
<enjolras_>
damjan: i do too. Also because it drains twice less battery
<ely-se>
tfw no smartphone
<enjolras_>
flux: even if nobody use it, xmpp is almost ready or a lot of things, like games or microblogging platforms like jappix or movim, while matrix is far from this
<enjolras_>
even if in theory there is no technical limitation to prevent that. It's just not done yet
AlexRussia has joined #ocaml
ely-se has quit [Quit: leaving]
<zol>
I guess there are no other micro web frameworks then?
<Drup>
other than what ?
<zol>
Opium?
<Drup>
hum, not really, you don't like it ?
<Drup>
you can always use cohttp directly, but it's not a framework :)
<zol>
Drup: I had some problems yesterday when playing around with it. It seems good! Just that the routes kept 404:ing.
<Drup>
(the concept of "micro framework" is .. debatable :p)
<zol>
But could be that my ocaml is not strong enough.
<Drup>
that sounds like a bug, you should ask rgrinberg
<zol>
Drup: Mainly wanted something to construct a REST API easily to learn OCaml. :)
<zol>
Drup: I compiled the example code on the github, and /person/bengt/27 worked, but then /hello/bengt kept 404:ing, so was probably something did myself. Also, none of the requests appeared when running with verbose flag (which I half expected when I ran it)
Haudegen has quit [Ping timeout: 250 seconds]
ontologiae has quit [Ping timeout: 240 seconds]
<MercurialAlchemi>
Drup: what's debatable about it?
tane has quit [Quit: Verlassend]
Haudegen has joined #ocaml
<Drup>
MercurialAlchemi: well, the concept of a framework is to provide you a ... framework, in which to program your code. If it's micro, it's not a framework, it's just a library that you use on the side.
<MercurialAlchemi>
hmm
<MercurialAlchemi>
not really
<MercurialAlchemi>
libraries give you control, frameworks force you to structure your code in a particular way
<MercurialAlchemi>
in exchange for not having to write all the boilerplate yourself
keen__________22 has quit [Ping timeout: 244 seconds]
<MercurialAlchemi>
I don't really know Opium, but a microframework like Flask still makes you write handlers in a particular way and has a machinery to give you access to the current request, etc...
<Drup>
I see
<MercurialAlchemi>
it just has much less bolt-on per default than a full-fledged corporate framework
xet7 has quit [Read error: Connection reset by peer]
<zol>
Oh, rofl, rgrinberg I didn't see it was a PUT route.
* zol
blushes!
xet7 has joined #ocaml
xet7 has quit [Client Quit]
xet7 has joined #ocaml
mort___ has joined #ocaml
john has joined #ocaml
john is now known as johnf
jao has quit [Ping timeout: 244 seconds]
darkf has quit [Quit: Leaving]
travisbrady has joined #ocaml
oscar_toro has joined #ocaml
oscar_toro has left #ocaml [#ocaml]
<ollehar>
why doesn't ocaml use buffers for all strings in the compiler?
<ollehar>
no, I mean, for the language
<adrien>
Unix definitely depends on String/Bytes
<ollehar>
adrien: but you could convert it when necessary?
<ollehar>
or what do you mean?
<adrien>
I don't see how you can convert between the two without aalocating possibly a lot
<rgrinberg>
MercurialAlchemi: yeah they're a bit more raw but you can combine them with furl i guess. A lot of assembly required
<rgrinberg>
Drup: how's fmt different from easy-format?
samrat has joined #ocaml
<ollehar>
adrien: why? Buffer.contents just maps to %identity
ontologiae has quit [Ping timeout: 244 seconds]
jwatzman|work has joined #ocaml
<adrien>
ollehar: hmmm, what do you mean?
<ollehar>
adrien: I mean, the buffer uses Bytes. when you convert it to string (with Buffer.contents), unsafe_to_string is used, which is just the C %identity function.
octachron has quit [Ping timeout: 260 seconds]
<ollehar>
yet, Buffer is _way_ faster for concatenation.
<adrien>
I don't have the sources of ocaml with me but I expect that you're not taking the "size" stuff into account
<ollehar>
size of string? or size of bytes?
<ggole>
Buffer.contents isn't %identity? Or did that change?
<adrien>
the buffer inside Buffer is >= the content length
<ollehar>
the Bytes module uses string_length C functions etc
<ollehar>
adrien: ah ok
<adrien>
there's some additional info
<adrien>
when you add one char and need more buffer space, the new size isn't just +1, it's *2
<adrien>
in order to save on allocations
<ollehar>
ggole: hm, I'm reading 4.03 source
<adrien>
(maybe not 2 but it's multiplicative, not additive)
<ollehar>
It creates a new byte/string with the correct length
<ollehar>
But you could make the buffer more intelligent by memoizing the converted string, and mark it as dirty if the buffer is updated.
<zol>
I'm trying to understand some part of the Opium example; `String ("Hello " ^ param req "name" ) |> respond'". What does the ` and ' operators mean in this context?
<zol>
Not sure if they are operators even.
beginner has joined #ocaml
<beginner>
i am looking for the source code for opis. Does someone know where i can find it?
<cmtptr>
zol, respond' is just a symbol name (as in respond prime). the backtick in `String makes it a polymorphic variant
<zol>
cmtptr: Thanks
uris77 has joined #ocaml
snyp has joined #ocaml
<ollehar>
do you guys think there's a way to type-infer (or something like that) when it would be appropriate to use string buffer vs ordinary string?
jbrown has quit [Ping timeout: 264 seconds]
mort___ has quit [Quit: Leaving.]
cschneid has quit [Ping timeout: 246 seconds]
cschneid has joined #ocaml
travisbrady has quit [Ping timeout: 264 seconds]
<dmbaturin>
ollehar: Well, maybe it's appropriate to treat it as a buffer if destructive operations are used on it, i.e. assign the buffer type to destructive string functions.
NingaLeaf has quit [Quit: Leaving]
<ollehar>
dmbaturin: e.g. a[5] = 'a'?
<dmbaturin>
Yep. And then warn the user if they are trying to use immutable string functions on what they just treated as mutable.
<ollehar>
hm
<mrvn>
String has destructive functions? Didn't they all move to Bytes?
<dmbaturin>
mrvn: I think ollehar is talking about his PHP type system project.
<ollehar>
don't know, but I intended it as a general discussion, not ocaml specific :)
<orbitz>
Only if you compile with safe-strng
<mrvn>
ollehar: a.[5] = 'a' is not destructive. That's simply a bool
<ollehar>
orbitz: I'm just using my trivial benchmark as a starting point.
<orbitz>
mrvn: yes I understand, I'm just not sure if this is an actual problem. How smart is the existing php implementation about this?
<ollehar>
orbitz: I don't know! it's using realloc, but I'm not sure that's the hole explanation.
<mrvn>
ollehar: maybe strings could be concated lazyliy (just collect a list a strings) and only copied when the result is used.
<orbitz>
ollehar: ah, realloc could help.
<ollehar>
wait, brb, have to sell a bed.
<orbitz>
THe thing is, I'm not sure using a Buffer helps at all. Consider: while(true) { x += y; print(x); }
ely-se has quit [Quit: Leaving]
<mrvn>
orbitz: wouldn't that List.iter print_string x.strings instead of actually constructing a string each time?
<orbitz>
In some was i tis anonyign that Ocaml conatienrs generally don't differentiate between capacity and size
<orbitz>
mrvn: perhaps, I am udner the impression ollehar is trying to support PHP though, in whch case I'm not sure how easy it i sto make those optimziations
<orbitz>
Especially in PHP where the entire universe is mutable.
<ollehar>
orbitz: good point! writing that one down...
<ollehar>
orbitz: yes, I plan to use the PHP runtime, which of course makes it more complicated still.
<ollehar>
but basically, if you have a char* and length, you can just copy the pointer to zend_string before using PHP runtime calls.
<ollehar>
mrvn: lazy list is really cool too.
igoroliveira has joined #ocaml
<apache2>
hm, I'm tryign to define a type: type mytype = Record of {foo : string;}
<apache2>
Parse error: [semi] expected after [str_item] (in [implem])
<apache2>
what am I doing wrong?
<cmtptr>
type mytype = {foo : string;}
<apache2>
but I'd like to be able to have it be type mytype = Int of int | Record of {foo: string;}
<cmtptr>
oh
<smondet>
apache2: that syntax (“inline records”) is for the next version of ocaml, not released yet
<apache2>
do I need to define a record_type first?
octachron has joined #ocaml
<apache2>
smondet: alright! looking forward to that
<apache2>
will the next version have dead code/module elimination too?
<smondet>
current version already has a lot of that, but if you're talking about “flambda” I don't know if it is planned for th next version or later
<apache2>
ok. how about warnings about nonexhaustive exception matching?
ely-se has joined #ocaml
<sgeisenh>
You're probably missing a possible exception case in a try ... with. Hard to tell without looking at your code.
<apache2>
oh I don't have a problem right now
<apache2>
but I'd like to have the compiler warn me about unguarded List.hd for example
<sgeisenh>
I don't know how tractable it is to have the compiler check for exception exhaustiveness.
<sgeisenh>
exn can have arbitrarily many variants
<zozozo>
apache2: the compiler warns about non exhaustive pattern matching
<apache2>
zozozo: no, it doesn't
<apache2>
sgeisenh: ok :(
<zozozo>
apache2: however, List.hd has a branch for empty lists, which raises the invalid argument exception if I remember correctly
<sgeisenh>
As it stands, there is always an implicit "| e -> raise e" case at the end of every try ... with
<apache2>
sgeisenh: yeah, that feels a bit dodgy. have to thoroughly scan included modules for exceptions to be certain your code is safe
<zozozo>
ah, well, the type system does not keep track of exceptions so you cannot guarantee that an expression will not raise an exception...
<sgeisenh>
the type system does keep track of exn
<flux>
I guess then it varies a lot what people meen by 'keeping track' :)
<flux>
it keeps track of exceptions just as much as python does..
<zozozo>
apache2: pattern matching exhaustiveness only applies to variants
<sgeisenh>
exceptions are variants
<sgeisenh>
exn is an extensible type
<sgeisenh>
you can add arbitrarily many variants
<zozozo>
right
<sgeisenh>
you can actually write some pretty cool programs passing exns around
<sgeisenh>
not that you ever should..
<flux>
given expression f (), the type system does not indicate if it can throw a 'variant' of any kind. I wouldn't call that 'tracking'.
jbrown has joined #ocaml
<flux>
sgeisenh, nowadays you can just have open types instead of abusing exn
<sgeisenh>
I come from SML, so abusing exn comes more naturally to me ;/
<apache2>
open types, is that polymorphic variants?
<flux>
no
<flux>
type t = .. (* open type *)
<flux>
well, i'll spoil it for you: type t += I of int
<apache2>
how does that work?
<flux>
it's like an exn type you can define yourself
<apache2>
can I define a type a = I of int type b = .. typ b += a ?
<flux>
no
<flux>
you start with type a = ..
<flux>
though I guess your case would make sense
shinnya has joined #ocaml
<flux>
maybe in future :-)
<apache2>
last time I asked, people told me to use objects
<apache2>
then I gave up
<ollehar>
orbitz: actually, this: while(true) { x += y; print(x); }, is still faster with buffer than with string (in ocaml). (benchmark: http://pastebin.com/AxNEjaLR)
<flux>
ollehar, it should be no surprise, yes?
<ollehar>
flux: but.. why then use string at all?
<flux>
ollehar, ..maybe because you don't always need to construct strings that way
<ollehar>
flux: you know the use-case where string is faster?
<sgeisenh>
apache2: regardless of the way that exception checking works, most good libraries postfix any non-obvious functions that throw with exn, so hopefully you don't do too much extraneous searching for exceptions
<flux>
well, in future strings will be immutable, as they should always have been, so that's a plus
<apache2>
for sure flux
<flux>
Buffer.t has larger per-object overhead
<flux>
also I guess it isn't compatible with C strings, but I don't know really
<apache2>
sgeisenh: unfortunately the standard library sucks, by your definition
<apache2>
List.exn_hd would be fine with me
<sgeisenh>
apache2: yes, for most serious programs, you should probably be using a standard library overlay
<apache2>
otherwise I might as well be using python or php
<flux>
there was an analyzer that finds out leaking exceptions from an ocaml program, but it's so old that it hasn't worked for years
<apache2>
if I didn't care about type safety :P
<flux>
it's not a simple problem, particularly not without explicit type annotations
<apache2>
well-defined naming conventions get you far in perl too
<ollehar>
flux: memory is less important than speed, since it's cheaper (in $) than CPU:s. and yes, you have to convert the buffer before you can use it as a byte/string.
<apache2>
sgeisenh: the problem is when I'm using a library that doesn't do so :(
mcclurmc has joined #ocaml
bjorkintosh has quit [Read error: Connection reset by peer]
<flux>
ollehar, I think the point is that people like to think strings as 'mostly immutable', where as buffers are 'mostly mutable'
<flux>
ollehar, when used in type signatures, it passes your intended use case better
<flux>
there are exceptions, of course ;)
bjorkintosh has joined #ocaml
<flux>
when strings actually become immutable it works better
<flux>
but then you might wonder, why bytes and not just Buffer?
<flux>
and that's maybe not a bad question :). at least it cannot be changed for compatibility reasons. on the other hand, this whole string/bytes holabaloo would have been a fine case to break compatibility..
<flux>
but it would also break compatibility with C bindings and that might be annoying in particular as there is no type system to save you from that breakage
mcclurmc has quit [Remote host closed the connection]
snyp has quit [Ping timeout: 265 seconds]
<flux>
ollehar, btw, you could loko into Ropes as well
<flux>
that's another approach at immutable but concatenable strings
native_killer has quit [Quit: Leaving]
<ollehar>
flux: Ropes? ah, data structure.
<ollehar>
thanks for the tip!
snyp has joined #ocaml
jbrown has quit [Remote host closed the connection]
jbrown has joined #ocaml
<ollehar>
yes, it would surely be awesome if the program could infer string, buffer/ropes by itself... someone must have written a paper on that.
<companion_cube>
flux: I agree, Buffer could have subsumed Bytes
<companion_cube>
if it had gained random access and a few more utils...
octachron has quit [Quit: Leaving]
mcclurmc has joined #ocaml
samrat has quit [Ping timeout: 255 seconds]
mcclurmc has quit [Remote host closed the connection]
snyp has quit [Quit: WeeChat 1.3]
johnf has quit [Read error: Connection reset by peer]
samrat has joined #ocaml
<Drup>
rgrinberg: easy-format is not a very good nor convenient library ...
<Drup>
Fmt is really just "a set of combinators for Format's %a"
mcclurmc has joined #ocaml
rgrinberg has quit [Ping timeout: 256 seconds]
rand___ has joined #ocaml
rand__ has quit [Ping timeout: 265 seconds]
johnf has joined #ocaml
ollehar1 has joined #ocaml
ollehar has quit [Ping timeout: 250 seconds]
ollehar1 is now known as ollehar
<ely-se>
I want to do something I've never done before
<icicled>
ely-se, that's the way to do it!
<ely-se>
in terms of programming
<icicled>
also very good!
<ely-se>
I'm getting bored of writing ERP systems and compilers.
<Drup>
(write a compiler for ERP system :D)
<ely-se>
I could write an ABAP compiler
<ely-se>
but it's not worth it
<icicled>
we should swap jobs
<ollehar>
maybe read The Limits Of Software? a guy in the book built a canoe while working on a system to revolutionize computing, then disappeared for a month on the canoe. his wife got worried. :) when he came back he was done with computers.
<ely-se>
I have no wife
samrat has quit [Ping timeout: 272 seconds]
<ollehar>
well, that's the first step then.
<ollehar>
--> okcupid
<ely-se>
I don't want one :(
<def`>
I have no system to revolutionize computing
mcclurmc has quit [Remote host closed the connection]
<companion_cube>
ely-se: what, you want two?
<ely-se>
If you have two, you also have one, so no.
<companion_cube>
Drup: is fmt better than CCFormat? :>
<ely-se>
maybe I want to do something with astronomy
<Drup>
companion_cube: yes
<companion_cube>
I'm falous
<companion_cube>
jalous*
<def`>
jealous?
<companion_cube>
yes
<ely-se>
I've never been interested in anything other than software development
<Drup>
companion_cube: actually, I haven't looked at CCFormat, because this shouldn't be inside containers :3
<companion_cube>
uh
<companion_cube>
of course it should
<MercurialAlchemi>
I like programming too, but the world is much bigger than that :)
<companion_cube>
I don't say it should be only in containers, but it has its place in there
<MercurialAlchemi>
Drup: containers should contains the world
<companion_cube>
Format is a part of the stdlib...
<MercurialAlchemi>
s/contains/contain/, ugh
<MercurialAlchemi>
companion_cube: er, you're taking the stdlib as an example of good design?
<companion_cube>
no, but I try to complement the stdlib
<companion_cube>
(and I think Format has its place in the stdlib, too)
<MercurialAlchemi>
(in this case I think you're right, because most language have a printf-like thing)
<Drup>
companion_cube: that's not what I meant
nullcatxxx_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<companion_cube>
ah.
<Drup>
I meant, as with sequence
<Drup>
small independent thingy
<ely-se>
I would like to attend univerisity and study CS, but I'm not allowed to
<companion_cube>
I'm not very happy to add a dependency for 5 functions
<companion_cube>
especially if I add 10 dependencies for 5 functions each
jita has joined #ocaml
samrat has joined #ocaml
rgrinberg has joined #ocaml
<companion_cube>
but you will be happy, next containers won't have lwt stuff
<jita>
Which language is easier to learn haskell or ocaml with the background of imperative programming?
<flux>
let's see the topic of the channel.. why ocaml of course!
<nicoo>
jita: I think OCaml is simple to learn, but I might be somewhat biased
<companion_cube>
o/ nicoo
<nicoo>
o/ companion_cube :)
<ely-se>
jita: the problem with answering that is that people who know both have learned one before the other and hence the latest one learned was easier to learn
kushal has joined #ocaml
<icicled>
ocaml is definitely easier if you have an imperative background
<icicled>
haskell is quite a lot harder to digest
<jita>
and is it easier to learn haskell after ocaml or is it totally different territory?
<icicled>
I reckon it's a bit easier
<ely-se>
I really want to learn more about type theory and algorithms and data structures
<ely-se>
but it's so difficult to find good learning material
<icicled>
my experience was: haskell -> give up -> ocaml -> haskell (read a few papers) -> ah ok I get haskell now -> I tinker with both
<jita>
icicled: do you still use imperative languages?
<jita>
ely-se: in ocaml ?
<icicled>
yes, python daily
<icicled>
and a bit of java
<ely-se>
jita: in general
<jita>
icicled: do you prefer ocaml over python
<jita>
?
<ely-se>
I also use imperative languages
<ely-se>
for concurrent problems Go is typically my first choice
<icicled>
I do
mcclurmc has joined #ocaml
<icicled>
types are so useful
<icicled>
you get to think less
<jita>
icicled: but one can have types in imperative lanuges as well
<ely-se>
icicled: I can't wait for mypy
<icicled>
yes you can but they're broken
<ely-se>
jita: yes, but you were talking about Python in particular
<ely-se>
and Python has only one type
<ely-se>
.. which isn't very helpful
<icicled>
I did java for ~8 years...types in Java suck
<jita>
icicled: Can you please elaborate on that?
<icicled>
a simple example: sum types
<icicled>
the compiler in ocaml and haskell will help you fill in any missing pieces
<icicled>
java...won't
<ely-se>
Java has downcasts to generic classes, but no reified generics. Conclusion: unsafe crap.
<companion_cube>
why would you need reified generics?
<icicled>
you can re-factor in ocaml and haskell with confidence - change one type and the compiler will tell you where all it needs to be fixed
<Drup>
companion_cube: I just looked at CCFormat ... yeah it's really better
<icicled>
in java - you get lucky most of the time
<ely-se>
companion_cube: for making downcasts safe
<companion_cube>
oh
<companion_cube>
Drup: yes, fmt has more things
<ely-se>
in Java you can upcast List<String> to Object and then downcast to List<Integer> and it will compile and run fine
<Drup>
but it's not your fault, it's because I started using Fmt for real stuff and added back my combinators
<ely-se>
the downcast should fail, like in C#, but you need reified generics for that to work
<companion_cube>
but that's probably the one Bünzli lib I won't use
<Drup>
you would be wrong, because that's the most useful one he ever did :D
lobo has joined #ocaml
<jita>
thats really interesting information, thanks all for shedding some light. One question more, is Swift functional language like Ocaml ?
<companion_cube>
Drup: meh. What's so cool about it, really?
<companion_cube>
I mean, jsonm or xmlm or uutf seem much more useful and hard to replicate
<Drup>
companion_cube: the API is really nice for Format things
<Drup>
you have both good control and expressivity, even for weird code patterns
<companion_cube>
like, box combinators?
<companion_cube>
ohh, color
<companion_cube>
this is indeed nice
<companion_cube>
I think Bünzli uses BSD, right? I'm thinking of stealing code now :p
samrat has quit [Ping timeout: 255 seconds]
<Drup>
:D
<jita>
And also can somebody recommend me really good book on ocaml ?
samrat has joined #ocaml
sh0t has joined #ocaml
<ollehar>
jita: real world ocaml
<jita>
ollehar: thanks
<ely-se>
On a scale from PowerShell to Bash, how much of a pain is it to work with OCaml on Windows?
<companion_cube>
heh
<companion_cube>
ask adrien
<ely-se>
hey adrien
nullcatxxx_ has joined #ocaml
<flux>
if opam worked on windows, that would be a lot
<jita>
ely-se: there's f# for it i suppose
<flux>
it opam packages as well worked on windows, that would be perfect :)
<ely-se>
hmm
<flux>
jita, that's probably the realistic best solution..
<ely-se>
maybe I should try Vagrant then
<flux>
but F# doesn't have all the features OCaml has!
<flux>
on the other hand, it integrates well with the .NET
<ely-se>
F# is .NET and I don't want to use Visual Studio
<ely-se>
and .NET without VS is doom
<flux>
do you want to use windows without .net?
<companion_cube>
is cygwin out of question?
<ely-se>
preferably I wouldn't want to use Windows, but I CBA to install Gentoo
<ely-se>
maybe I'll play with Eiffel some more this weekend
jita has quit []
JuggleTux has joined #ocaml
samrat has quit [Ping timeout: 250 seconds]
samrat has joined #ocaml
JuggleTux has quit [Ping timeout: 240 seconds]
BitPuffin|osx has quit [Remote host closed the connection]
samrat has quit [Ping timeout: 246 seconds]
<MercurialAlchemi>
ely-se: you don't do many casts in modern java
<MercurialAlchemi>
so I don't find that argument very convincing
Kakadu has joined #ocaml
samrat has joined #ocaml
alexst has joined #ocaml
<orbitz>
I don't think the downcast of Object to List<Integer> would work
MercurialAlchemi has quit [Ping timeout: 255 seconds]
<orbitz>
ely-se: so it is. Terrible terrible language.
<ely-se>
:p
<ely-se>
orbitz: also fun: because of erased generics, you can't have generic classes inherit from Throwable
<ely-se>
since you couldn't discriminate between E<T> and E<U> in catch clauses
<orbitz>
:)
<orbitz>
Such beauty
bjorkintosh has quit [Quit: Leaving]
<def`>
exn is also parameter less :p
<ely-se>
yeah, but OCaml exceptions work differently, and OCaml erases all type information
<def`>
true :)
<ely-se>
you don't create a separate type for each exception
<def`>
it's more the class than the type which is important here
<def`>
but yeah, classes are not parametric...
<def`>
you should be able to inherit from E<U>
<def`>
but in a catch U is just an existential you can't tell anything about
<ely-se>
Go also has a single error type, and you create globals of that type and check them with ==
<ely-se>
dunno what to do this weekend
<ely-se>
maybe I'll write something in OCaml
ygrek has joined #ocaml
Submarine has quit [Ping timeout: 240 seconds]
snyp has joined #ocaml
bjorkintosh has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
<ely-se>
I should write a program in which every function is written in a different programming language, using at least C++, COBOL, Haskell and OCaml, with FFIs
kushal has quit [Quit: Leaving]
<ely-se>
that should be fun :)
LnL has quit [Ping timeout: 260 seconds]
slash^ has quit [Read error: Connection reset by peer]
Submarine has joined #ocaml
Submarine has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
ely-se has quit [Quit: Leaving]
mac10688 has joined #ocaml
johnf has quit [Read error: Connection reset by peer]
snyp has quit [Quit: WeeChat 1.3]
Simn has quit [Quit: Leaving]
sh0t has quit [Ping timeout: 256 seconds]
ygrek has quit [Ping timeout: 265 seconds]
acieroid` has joined #ocaml
acieroid has quit [Read error: Connection reset by peer]
<ollehar>
in what scenario would immutable strings perform better than buffers? I'm trying to figure out a benchmark where immutable strings would win...
<apache2>
!concurrency!
<companion_cube>
it's more a correctness issue, I think
<companion_cube>
mutable strings are dangerous
tane has quit [Quit: Verlassend]
rgrinberg has quit [Ping timeout: 246 seconds]
<apache2>
yeah :)
<apache2>
also the old string implementation was completely ridiculous
<ollehar>
that's it? then that argument is completely irrelevant for me, because I will never support that in my PHP dialect.
<ollehar>
*that = concurrency
<ollehar>
apache2: ridiculous how?
damason has joined #ocaml
<apache2>
let my_name = "mike" in let your_name = "mike" in my_name.[0] <- 'b' ; Printf.printf "%s != %s" my_name your_name
<apache2>
will print "bike != bike"
<apache2>
because someone figured "ah well all strings that are equal might as well be shared"
<apache2>
and then someone else figured "hey these strings should still be mutable"
<ollehar>
ah ok, well, you can't have both ^^
<apache2>
:D
<apache2>
the sensible thing imo would be a copy-on-write approach at least :D
<apache2>
changing all instances ofa string value is insane
rgrinberg has joined #ocaml
<ollehar>
yeah
<apache2>
why are you making a php dialect?
johnf has joined #ocaml
<companion_cube>
masochism, I suppose
empyrean has quit [Remote host closed the connection]