<mrvn>
haesbaert: the the FD to non blocking and it will return early.
<mrvn>
single_write will, iirc, only write once and only up to 16k and then return however much it has written.
<mrvn>
s/the the/set the/
<haesbaert>
I'm actually using Lwt, and it says that Lwt_unix.write has the "same semantics" as Unix.write, but looking at the code, it doesn't seem so
<mrvn>
haesbaert: write also writes in 16k chunks but loops till len is reached or an error
<mrvn>
why would you want a shortcount with lwt?
<haesbaert>
not that I want to, but I need to be able to read more stuff if I get a shortcount
<mrvn>
then just read. lwt will keep writing in the background
AltGr has joined #ocaml
<haesbaert>
but lets say I have: read_into ic buf bla bla >>= fun n -> write_into oc buf bla bla; recurse()
<haesbaert>
sorry:
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<haesbaert>
but lets say I have: read_into ic buf bla bla >>= fun n -> write_into oc buf bla n; recurse()
<mrvn>
then don't reuse buf
<haesbaert>
now, as long as write doesn't finish writing the "whole n", my read won't run, right ?
<mrvn>
or wait for completion
nullcat has joined #ocaml
Simn has quit [Quit: Leaving]
sdothum has joined #ocaml
<haesbaert>
not sure I follow either of both suggestions
<mrvn>
haesbaert: if you set the FD to non blocking then you should get a short write and a EAGAIN on the next try
<mrvn>
But the real question is wether you want to alternate read and write or do them concurrent
MrScout has joined #ocaml
<haesbaert>
concurrent would be, so you mean everytime I read, I wake another Lwt to do a write ?
<mrvn>
you queue up the buffer for writing in another lwt. You have to keep the writes in order.
<haesbaert>
hmm, right now I'm keeping track of a writing and reading index, expecting I'd have a shortcount
<mrvn>
but on a shortcount you have to track how much was written and then start again from there next time you write.
<haesbaert>
yep
tristero has joined #ocaml
<mrvn>
And you can't read any more into the buffer unless you move the remainder to the front or something. That would realy waste cpu.
<mrvn>
So better to just have one reader and one writer thread
MrScout has quit [Read error: Connection reset by peer]
<haesbaert>
I just reset the buffer when the reader catches up
<haesbaert>
read moves a rpointer, w moves a wpointer, when r = w, I reset both to 0
MrScout has joined #ocaml
<haesbaert>
it's ok to stall in my case
<haesbaert>
I just can't have the writer blocking the reader
<mrvn>
haesbaert: so you want shortcount on read too?
<haesbaert>
the amount read on read is not relevant, I try to fill a 4k buffer from a tcp sock
<mrvn>
then do that and then pass the buffer to the writer thread. Let that write the whole thing while the reader fills the next buffer.
<haesbaert>
hmm I suppose I can share the same buffer, if I'm careful with the indexes
<mrvn>
I wouldn't.
<haesbaert>
I wouldn't like doing two allocations
<mrvn>
you can pre allocate an number of buffers and pass them back and forth.
<mrvn>
That would also naturally limit the amount of read ahead.
ollehar has quit [Quit: ollehar]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<haesbaert>
ack, it's just a nc(1) clone, I was trying to keep it simple
<mrvn>
then you still want non-blocking so you get short reads. In case the user only presses a single key you don't want to wait for the other 4095 bytes.
<haesbaert>
but for that you don't need non-blocking at all
<haesbaert>
the read is not a read_really
<haesbaert>
read fd buff ofs len reads len bytes from descriptor fd, storing them in byte sequence buff, starting at position ofs in buff. Return the number of bytes actually read.
WraithM has quit [Quit: leaving]
<mrvn>
yes you do. It is unspecified wether a blocking read from a socket will wait for all the data or only return as much as present.
<haesbaert>
unspecified by the ocaml read, or the syscall ?
<mrvn>
Common implementation is to block on files and return early on sockets and pipes. But nothing says that is so. You need non-blocking to get a defined behaviour.
<mrvn>
haesbaert: unspecified by posix and probably windows/mac too
<mrvn>
the syscall
<haesbaert>
although it is not specified that a blocking SOCK_STREAM socket will not block unless the whole requested block is requested,
<haesbaert>
that is defeated by the premise that the records boundary are part of application, and frankly, I've never seem a SOCK_STREAM sock implementation that would wait for the requested bytes.
<mrvn>
it is specified that non-blocking will not block and that's the behaviour you want.
ygrek has joined #ocaml
<haesbaert>
it's ok for me to block on read, I just can't block on write
<mrvn>
It actually will block if there is no input. In your code above that would leave you blocking with bytes to write and doing nothing.
<mrvn>
Not nice for nc
<haesbaert>
true, assuming the write is sequential after the read, like the code I pasted
<haesbaert>
I'm still wrapping my head around Lwt, thinking in threads is hard
<mrvn>
another point for splitting it into 2 threads
<mrvn>
means the writer can catch up when the reader blocks
madroach has quit [Ping timeout: 264 seconds]
<mrvn>
n8
<haesbaert>
night, thanks for the support
madroach has joined #ocaml
myyst is now known as myst
seangrove has quit [Remote host closed the connection]
seangrove has joined #ocaml
ghostpl_ has joined #ocaml
reem has quit [Remote host closed the connection]
ptc has joined #ocaml
ptc is now known as Guest42764
ygrek has quit [Ping timeout: 272 seconds]
Guest42764 has quit [Ping timeout: 255 seconds]
ghostpl_ has quit [Ping timeout: 264 seconds]
ptc_ has joined #ocaml
reem has joined #ocaml
shinnya has quit [Ping timeout: 272 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
MrScout has quit [Ping timeout: 256 seconds]
nullcat has quit [Ping timeout: 246 seconds]
The_Mad_Pirate has quit [Excess Flood]
The_Mad_Pirate has joined #ocaml
claudiuc has quit [Ping timeout: 256 seconds]
nullcat has joined #ocaml
Algebr has joined #ocaml
<Algebr>
Are the schedulers in stuff like Async/Lwt using algos like OS type scheduler, ie Round Robin, etc.
psy_ has joined #ocaml
psy_ has quit [Max SendQ exceeded]
psy_ has joined #ocaml
darkf has joined #ocaml
ptc_ has quit [Ping timeout: 244 seconds]
<tobiasBora>
Hello !
<tobiasBora>
I have a problem with format...
<tobiasBora>
With ksprintf I manage to do a function of type string -> int -> int -> (unit, unit, string, unit) format4 -> unit
<tobiasBora>
However when I do myprintf brick_name verbose 3 "===== Hello %s =====" name
<tobiasBora>
I have an error :
<tobiasBora>
Error: This function has type
<tobiasBora>
string -> int -> int -> (unit, unit, string, unit) format4 -> unit
<tobiasBora>
It is applied to too many arguments; maybe you forgot a `;'.
<tobiasBora>
How could I say to ocaml that --->"==== Hello %s ====" name<--- is a format ?
<SGrondin>
you could add a type annotation where it's declared
lordkryss has quit [Quit: Connection closed for inactivity]
<tobiasBora>
SGrondin: What do you mean ? I already have a mli file with val printf :
<tobiasBora>
string -> int -> int -> (unit, unit, string, unit) format4 -> unit
<SGrondin>
in that case I'm not following you.. it would help if you made a gist or a pastebin with a code example
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<flux>
tobiasbora, consider this code: let a = let b = ref None in fun arg -> let old_value = !b in b := Some arg; old_value
<flux>
your code of course doesn't do this kind of bad things, but I suppose it's hard to detect only the 'really' bad cases
AltGr has joined #ocaml
MetalWolf has quit [Ping timeout: 252 seconds]
MetalWolf has joined #ocaml
MetalWolf is now known as Guest61842
govg has quit [Ping timeout: 252 seconds]
govg has joined #ocaml
ghostpl_ has joined #ocaml
govg has quit [Ping timeout: 252 seconds]
govg has joined #ocaml
ghostpl_ has quit [Ping timeout: 264 seconds]
Guest78507 has quit [Ping timeout: 246 seconds]
prsn has quit [Ping timeout: 252 seconds]
prsn has joined #ocaml
badkins has quit [Remote host closed the connection]
carm is now known as struk|desk
MrScout_ has quit [Ping timeout: 265 seconds]
pii4 has quit [Ping timeout: 264 seconds]
pii4 has joined #ocaml
pii4 has quit [Max SendQ exceeded]
pii4 has joined #ocaml
reem has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 264 seconds]
boadie has joined #ocaml
boadie has quit [Ping timeout: 256 seconds]
reem has joined #ocaml
ghostpl_ has joined #ocaml
rgrinberg has quit [Ping timeout: 272 seconds]
ghostpl_ has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
Bhavya has joined #ocaml
reem has joined #ocaml
mearnsh has quit [Ping timeout: 272 seconds]
mearnsh has joined #ocaml
badkins has joined #ocaml
antkong has quit [Quit: antkong]
badkins has quit [Ping timeout: 250 seconds]
MrScout_ has joined #ocaml
arj has joined #ocaml
MercurialAlchemi has joined #ocaml
ygrek has joined #ocaml
xificurC has joined #ocaml
mengu has joined #ocaml
slash^ has joined #ocaml
reem has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 244 seconds]
MrScout_ has quit [Ping timeout: 265 seconds]
robink has quit [Read error: Connection reset by peer]
reem has joined #ocaml
robink has joined #ocaml
ghostpl_ has joined #ocaml
reem has quit [Remote host closed the connection]
ghostpl_ has quit [Ping timeout: 256 seconds]
<struk|desk>
phew these types errors are so misleading sometimes
<flux>
just insert more type annotations ;)
<struk|desk>
I figured it out
<flux>
I was going to draw the old "like violence" analogy, but I failed :(
<struk|desk>
I renamed a var to "value" by accident, which also happen to be a function the module, the compiler error was crazy. the fix was just rename variable to one already bound in a let block earlier
<struk|desk>
*function in the module
reem has joined #ocaml
AlexRussia has quit [Ping timeout: 240 seconds]
ggole has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
badon has quit [Ping timeout: 256 seconds]
octachron has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
Haudegen has quit [Ping timeout: 272 seconds]
tane has joined #ocaml
reem has quit [Remote host closed the connection]
reem_ has joined #ocaml
huza has joined #ocaml
Haudegen has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Ping timeout: 244 seconds]
antkong has joined #ocaml
Simn has joined #ocaml
antkong has quit [Client Quit]
antkong has joined #ocaml
<struk|desk>
okie dokie, time for bed about 4 hours ago, gnite all
ghostpl_ has joined #ocaml
<flux>
nite ;)
<xificurC>
struk|desk: byee
dav has quit [Remote host closed the connection]
dav has joined #ocaml
antkong has quit [Ping timeout: 256 seconds]
ghostpl_ has quit [Ping timeout: 245 seconds]
reem_ has quit [Remote host closed the connection]
reem has joined #ocaml
kakadu has joined #ocaml
huza has quit [Quit: WeeChat 0.3.8]
matason has joined #ocaml
Submarine has joined #ocaml
psy_ has quit [Ping timeout: 240 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
govg has quit [Ping timeout: 255 seconds]
arj has quit [Quit: Leaving.]
reem has joined #ocaml
lordkryss has joined #ocaml
ghostpl_ has joined #ocaml
ollehar has joined #ocaml
AltGr has left #ocaml [#ocaml]
nullcat has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
rand000 has joined #ocaml
avsm has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
kapil___ has joined #ocaml
ghostpl_ has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
reem has quit [Remote host closed the connection]
mort___ has joined #ocaml
govg has joined #ocaml
rgrinberg has joined #ocaml
govg has quit [Quit: leaving]
larhat has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 252 seconds]
ghostpl_ has joined #ocaml
ghostpl_ has quit [Remote host closed the connection]
mengu has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
dsheets has quit [Ping timeout: 245 seconds]
ghostpl_ has quit [Remote host closed the connection]
zpe has joined #ocaml
Haudegen has quit [Ping timeout: 250 seconds]
fedjo has joined #ocaml
dsheets has joined #ocaml
Haudegen has joined #ocaml
freling has joined #ocaml
zpe has quit [Remote host closed the connection]
Submarine has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 244 seconds]
waneck has quit [Ping timeout: 240 seconds]
axiles has quit [Ping timeout: 245 seconds]
ghostpl_ has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
bjorkintosh has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
bjorkintosh has joined #ocaml
ghostpl_ has quit [Read error: Connection reset by peer]
johnelse is now known as johnel_away
ghostpl_ has joined #ocaml
bjorkintosh has quit [Remote host closed the connection]
bjorkintosh has joined #ocaml
johnel_away is now known as johnelse
mengu has joined #ocaml
mengu has joined #ocaml
meteo has quit [Ping timeout: 250 seconds]
sdothum has joined #ocaml
_andre has joined #ocaml
boadie has joined #ocaml
axiles has joined #ocaml
boadie has quit [Ping timeout: 256 seconds]
ghostpl_ has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
<kakadu>
https://ocaml.org/docs/license.html seems a little bit outdated because it doesn't mention compiler-libs in libraries list. Am I right?
<adrien_znc>
dunno but compiler-libs should be the same license as compiler itself
<adrien_znc>
afk
<flux>
maybe not, isn't compiler-libs quite an essence of the compiler?
<flux>
though it should list it I suppose in one of the lists at the very least :)
<flux>
you should ask the mailing list?
<dmbaturin>
Anyone knows offhand what search path mpp uses for input/cat etc.?
thorsten` has quit [Ping timeout: 264 seconds]
rgrinberg has joined #ocaml
axiles has quit [Ping timeout: 240 seconds]
TheLemonMan has joined #ocaml
axiles has joined #ocaml
rgrinberg has quit [Ping timeout: 246 seconds]
thorsten` has joined #ocaml
madroach has quit [Ping timeout: 264 seconds]
Submarine has joined #ocaml
madroach has joined #ocaml
meteo has joined #ocaml
badkins has joined #ocaml
meteo has quit [Ping timeout: 255 seconds]
arj has joined #ocaml
badkins has quit [Ping timeout: 272 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
ghostpl_ has quit [Remote host closed the connection]
ghostpl_ has joined #ocaml
freling has quit [Quit: Leaving.]
rand000 has quit [Quit: leaving]
mengu has quit [Remote host closed the connection]
<chris2>
any idea why opam search core_profiler would list a package, but opam install core_profiler cant find anything?
<rks`>
might not be available on your version?
<chris2>
# Existing packages for 4.02.1:
<chris2>
shouldnt it be listed then?
<chris2>
hm, indeed. my core is too old
<rks`>
that's a bit weird
<rks`>
As you first guessed, I meant version of the compiler
<rks`>
but then, opam is mystery to me :]
<chris2>
yeah oO
<chris2>
and adding --verbose suddenly makes it figure out how to upgrade
meteo has joined #ocaml
<flux>
1) install aspcud 2) I think opam does have some bugs in its internal resolver..
<chris2>
probably should do that
<flux>
if you indeed find different functionality depending on the --verbose-switch, I think you should report it :-)
<chris2>
and sometimes it asks what do do and sometimes it just does
<flux>
look at step 1 :-)
<flux>
also, step 2
<chris2>
and i still believe if you need to map your packaging problem onto a NP-hard problem, you've done something wrong at some point...
mengu has quit [Remote host closed the connection]
Bhavya has joined #ocaml
paradoja has quit [Ping timeout: 264 seconds]
arj has left #ocaml [#ocaml]
steshaw_ is now known as steshaw
pdewacht has quit [Ping timeout: 256 seconds]
pdewacht has joined #ocaml
mengu has joined #ocaml
mengu has joined #ocaml
mengu has quit [Changing host]
avsm has joined #ocaml
<dmbaturin>
How do I enable building with -g in oasis?
dsheets has quit [Ping timeout: 264 seconds]
paradoja has joined #ocaml
zpe has joined #ocaml
freling has quit [Quit: Leaving.]
freling has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
cross has joined #ocaml
cross has quit [Client Quit]
avsm has quit [Client Quit]
cross has joined #ocaml
avsm has joined #ocaml
dsheets has joined #ocaml
avsm has quit [Client Quit]
waneck has joined #ocaml
avsm has joined #ocaml
avsm has quit [Client Quit]
dsheets has quit [Ping timeout: 256 seconds]
uris77 has joined #ocaml
dsheets has joined #ocaml
ptc has joined #ocaml
ptc is now known as Guest13294
freling has quit [Quit: Leaving.]
freling has joined #ocaml
<companion_cube>
dmbaturin: if you generate a configure file, there is a switch --enable-debug, I think
<dmbaturin>
companion_cube: Thanks, going to try. MPP doesn't use configure file though so I'd have to modify its oasis stuff first, but I figured it out already. :)
<dmbaturin>
Name shadowing when the shadowed binding has very different type is a bit evil.
arj has joined #ocaml
arj has left #ocaml [#ocaml]
mengu has quit [Remote host closed the connection]
<flux>
why? I think it's even better, no chance to confuse them :)
<companion_cube>
dmbaturin: otherwise you need to tell ocamlbuild rather than oasis
<whitequark>
apache2: most likely you are trying to use opam with camlp4 from a different switch
<whitequark>
or system camlp4
<whitequark>
adrien_znc: it's unlikely that this is an ocaml bug
<apache2>
whitequark: I'll try removing camlp4 and reinstalling
<whitequark>
try doing `which camlp4` and `echo CAML_LD_LIBRARY_PATH`
<whitequark>
if one refers to opam and other does not, you have a problem
leowzukw has joined #ocaml
<apache2>
they do, thanks
<dmbaturin>
companion_cube: I guess I need to learn more about using ocamlbuild directly.
<companion_cube>
good luck
rgrinberg has joined #ocaml
<dmbaturin>
Is "good luck" a warning that I'll really need luck in this case? :)
<whitequark>
with stuff in [] omitted for non-bar builds
<whitequark>
adrien_znc: camlp4 does not use mmap
<companion_cube>
well it doesn't look as easy as a call to configure, in an opam file
<whitequark>
with topkg you can do ocaml pkg/build.ml bar=true
<companion_cube>
I'll most likely wait for assemblage
<whitequark>
topkg is 90% assemblage, but right now :p
<whitequark>
bünzli also says topkg will be deprecated in favor of assemblage... but for now
<companion_cube>
90%? not if assemblage builds stuff itself, I guess
freling has quit [Quit: Leaving.]
<companion_cube>
(rather than calling ocamlbuild)
ebzzry has joined #ocaml
ebzzry has quit [Remote host closed the connection]
<Drup>
for now, it doesn't
<companion_cube>
that's why I'm waiting with oasis :p
<whitequark>
traitor
<companion_cube>
:p
ygrek has joined #ocaml
freling has joined #ocaml
Bhavya has quit [Remote host closed the connection]
<adrien_znc>
whitequark: hence the weird thing :)
shinnya has quit [Ping timeout: 265 seconds]
psy_ has joined #ocaml
uris77 has quit [Ping timeout: 264 seconds]
ygrek has quit [Ping timeout: 240 seconds]
rgrinberg has quit [Ping timeout: 240 seconds]
amirmc has joined #ocaml
rgrinberg has joined #ocaml
larhat has quit [Quit: Leaving.]
thomasga has joined #ocaml
myst has quit [Read error: Connection reset by peer]
myst has joined #ocaml
ygrek has joined #ocaml
axiles has quit [Ping timeout: 245 seconds]
axiles has joined #ocaml
Guest13294 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Submarine has quit [Remote host closed the connection]
antkong has joined #ocaml
alpen has quit [Ping timeout: 265 seconds]
bitbckt has quit [Ping timeout: 265 seconds]
struk|desk2 has joined #ocaml
mawuli has quit [Ping timeout: 265 seconds]
zozozo has quit [Ping timeout: 265 seconds]
welterde has quit [Ping timeout: 265 seconds]
S11001001 has quit [Ping timeout: 265 seconds]
rbocquet has quit [Ping timeout: 265 seconds]
mehdi__ has joined #ocaml
igitoor has quit [Ping timeout: 265 seconds]
struk|desk has quit [Ping timeout: 265 seconds]
whitequark has quit [Ping timeout: 265 seconds]
rossberg has quit [Ping timeout: 265 seconds]
mehdi has quit [Ping timeout: 265 seconds]
andreypopp has quit [Ping timeout: 265 seconds]
whitequark has joined #ocaml
alpen has joined #ocaml
bitbckt has joined #ocaml
mawuli has joined #ocaml
igitoor has joined #ocaml
badkins has quit []
zozozo has joined #ocaml
rbocquet has joined #ocaml
rossberg has joined #ocaml
AlexRussia has joined #ocaml
antkong has quit [Ping timeout: 245 seconds]
S11001001 has joined #ocaml
andreypopp has joined #ocaml
axiles has quit [Quit: Quitte]
planetlarg has joined #ocaml
welterde has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
<struk|work>
I've been trying to understand the lablqt / qml "binding". Can one use that system to link in basically any C++ lib?
jwatzman|work has joined #ocaml
jwatzman|work has quit [Read error: Connection reset by peer]
octachron has quit [Quit: Leaving]
rgrinberg has quit [Ping timeout: 240 seconds]
c74d has quit [Read error: Connection reset by peer]
rgrinberg has joined #ocaml
badkins has joined #ocaml
c74d has joined #ocaml
mort___ has quit [Ping timeout: 252 seconds]
ptc has joined #ocaml
<whitequark>
no
ptc is now known as Guest75891
<struk|work>
so ctypes / libffi it is. bleh
dav has quit [Ping timeout: 252 seconds]
<whitequark>
not for C++
planetlarg has quit [Quit: Ex-Chat]
TheLemonMan has quit [Quit: leaving]
leowzukw has quit [Remote host closed the connection]
dav has joined #ocaml
mahem1 has left #ocaml [#ocaml]
uris77 has joined #ocaml
badkins_ has joined #ocaml
badkins has quit [Ping timeout: 246 seconds]
thomasga has quit [Quit: Leaving.]
MrScout has joined #ocaml
thomasga has joined #ocaml
MrScout has quit [Remote host closed the connection]
enquora has joined #ocaml
Guest75891 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<struk|work>
ok I have on more possibility...maybe write "ppx_pof" which essentially would be a fork of "ppx_protobuf".
<struk|work>
smondet: do you think ketrew would work for a performance testing harness? Currently the harness is a homebrew hodge podge of shell scripts to rsync/launch from EC2 linux nodes, and then aggregate logs for stats afterwards.
<whitequark>
struk|work: what would that give you?..
dav has quit [Ping timeout: 246 seconds]
<struk|work>
whitequark: well I am trying to get ocaml into my work place. options are ocamljava, which I am trying to avoid because besides obvious issues with that approach it's ppx support isn't great. another possibility is I provide a binding to a coherence api, which would allow an ocaml runtime to join the existing coherence cluster. the final choice is I do SaaS over http or a messaging protocol.
rgrinberg has quit [Ping timeout: 246 seconds]
<struk|work>
whitequark: for that last choice, I would probably have to use Portable Object Format, since thats a first class binary protocol in my company (json would be too slow for interdatacenter communication)
<whitequark>
2nd one sounds best to me
<whitequark>
ah, that works too
Submarine has joined #ocaml
<companion_cube>
I wonder, didn't someone talk about a ctypes-like library for java?
<struk|work>
whitequark: 2nd one is pretty difficult, as coherence api is only java, .NET, or C++. it was originally written in java so it's very OO
ptc_ has joined #ocaml
<struk|work>
companion_cube: really? got a link?
ggole has quit []
<companion_cube>
oh, my bad, it's ctypes for ocaml-java -_-
<smondet>
struk|work: I'm not sure of what you would need Ketrew for, we can ta about it at the next meetup if you want
<smondet>
*talk
c74d has quit [Ping timeout: 265 seconds]
<Drup>
there is an entry somewhere in one of the ocamllabs wiki about that project
<Drup>
(in answer to "ctypes for java")
<struk|work>
smondet: sounds good, although I meet need to ask you questions sooner than that. I will study your docs some more today though
ygrek has quit [Ping timeout: 246 seconds]
<smondet>
struk|work: ok!
<struk|work>
smondet: first question..why does 4.02.X not supported?
WraithM has joined #ocaml
<smondet>
struk|work: it is in the master branch, 0.0.0 was using `ocp-build`, 4.02.x is one of the ways that tools is broken
<smondet>
but we switched to generating an _oasis file now :)
<smondet>
which is less broken
<Drup>
ahah, ocp-build
<struk|work>
smondet: ok cool
freling has quit [Quit: Leaving.]
jwatzman|work has joined #ocaml
zpe has quit [Remote host closed the connection]
Bhavya has joined #ocaml
AlexRussia has quit [Ping timeout: 255 seconds]
johnelse is now known as johnel_away
johnel_away is now known as johnelse
claudiuc has joined #ocaml
<tobiasBora>
flux: I'm not sure to understand why eta-expansion can cause any trouble since my variable isn't a reference... And I tried to add type annotations everywhere but my function is still '_a instead of 'a...
<tobiasBora>
Here is the function I cannot compile without defining start_time has a global variable...
kakadu has quit [Quit: Page closed]
larhat has joined #ocaml
<flux>
tobiasbora, it's a product of a function call. ref is a function. so in that sense there is no difference.
<flux>
the restriction is a bit strict, yes, but relaxing it in a sense that is still easy to understand is not quite straight-forward
<tobiasBora>
(with the link it's better :http://paste.ubuntu.com/10581310/)
ptc_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<tobiasBora>
flux: Hum you mean that the function (fun brick_name...) behaves like ref ?
<tobiasBora>
So there isn't any solution but defining start_time outside of the function, even by adding lot's of type annotations ?
<flux>
as far as I know, there aren't really other solutions
<flux>
then you need to call it like printf () ..rest of the args.. of course
<flux>
actually no
<flux>
now that I actually undestand what you want to use it for.. it's not suitable for you.
<flux>
because if you do let p = printf () .. the p you get is again value restricted
<mrvn>
tobiasBora: That fuinction works fine here
<flux>
mrvn, but this doesn't: printf "hello" 4 2 "hello world %s" "42"; printf "hello" 4 2 "hello world %d" 42
AlexRussia has joined #ocaml
<flux>
so your only option is to have the start time be a global. of course, you can hide the value in the module signature.
<tobiasBora>
flux: Yes, after I want to do something like >>>let p = printf () "my module" in<<< and use it like >>>p "Hello %s !" name<<<
<mrvn>
ahh, that you mean
<tobiasBora>
mrvn: yes the problem is here
<tobiasBora>
But in Ocaml a variable is fundamentally different from a function ?
<tobiasBora>
I though that a variable was a kind of constant function
<flux>
for example this works: module PrintingStuff : sig val printf : (string -> int -> int -> ('a, unit, string, unit) format4 -> 'a) end = struct let start_time = Sys.time () let printf fmt = Printf.ksprintf (fun s -> ..) fmt end let printf = Printing.printf
<mrvn>
tobiasBora: ocaml has no variables
thomasga has quit [Ping timeout: 265 seconds]
<flux>
though you cannot hide the PrintinfStuff module from current module 8-)
<smondet>
mrvn: I think even the manual uses the word "variable" for the names bound to constants by `let`
<tobiasBora>
flux: Yes I think I will keep this way to proceed... Thank you for your help !
<flux>
tobiasbora, good luck :)
<tobiasBora>
mrvn: So variable and function is the same thing ?
ghostpl_ has quit [Remote host closed the connection]
Bhavya has quit [Quit: Quit the channel]
<tobiasBora>
Not sure to understand the difference with variable... This binding seems to explain what is the link with the source code and the representation in memory
<tobiasBora>
but I don't see why it cannot be called a variable
<mrvn>
a variable is something like: int x; x = 0; ++x;
<mrvn>
it's a technical thing
rgrinberg has joined #ocaml
<Drup>
tobiasBora: mrvn is being pedantic and insist that variable are mutable, while the one in OCaml are immutable
<tobiasBora>
Oh I see
<Drup>
in practice, everyone call them variables, including the manual and the compiler error messages, and mathematicians since several (hundreds of) years.
<flux>
immutable variable is not in fact an oxymoron
<mrvn>
expect those people that explain eta-expansion and value restriction and that stuff
<tobiasBora>
By the way why is is impossible to modify a var... binding in Ocaml ? Is that for efficiency reasons ?
<flux>
for example: f(x) = x + 5 - x is an immutable variable
<Drup>
tobiasBora: semantic reasons
<flux>
why is it variable? because it varies from call-to-call.
<Drup>
immutability by default is just a better semantic
<mrvn>
flux: which x?
badkins_ is now known as badkins
<mrvn>
flux: you ahve 2 of them
<tobiasBora>
x is an immutable variable ?
<tobiasBora>
And what is f ?
<mrvn>
tobiasBora: a value, same as 5
rgrinberg has quit [Ping timeout: 245 seconds]
Denommus has quit [Remote host closed the connection]
<flux>
mrvn, it was a mathematical function. or in ocaml syntax: let f x = x + 5
<flux>
there are yes two x's, but they refer to the same instance
<mrvn>
flux: one is free and one is bound
<tobiasBora>
flux: I see
<mrvn>
iirc my theory correctly
<mrvn>
-c
<Drup>
both are bound.
axiles has joined #ocaml
<Drup>
there are no free variable here
<Drup>
there is a binder and 2 bound variables, period
<mrvn>
right, binder. that's what I was looking for.
<tobiasBora>
mrvn: So what I call a function is a value for Ocaml ? And a value is different from an immutable variable ?
<mrvn>
tobiasBora: evrything in ocaml is a value
<mrvn>
tobiasBora: so that doesn't help you much
<tobiasBora>
mrvn: So I don't really understand why there is a difference between the function with a unit at the beginning and not...
<mrvn>
tobiasBora: and a variable (binding) gives a value a name
<tobiasBora>
ok
<Drup>
a binding is the piece of syntax/semantic that binds the variable
<Drup>
that's all
<Drup>
nothing else
<mrvn>
tobiasBora: the difference is that printf takes an argument before calling Sys.time ().
Haudegen has quit [Ping timeout: 255 seconds]
<mrvn>
let printf () = ....
<mrvn>
unit -> string -> int -> int -> ('a, unit, string, unit) format4 -> 'a = fun
<mrvn>
# let g = printf ();;
<mrvn>
val g : string -> int -> int -> ('_a, unit, string, unit) format4 -> '_a = <fun>
Bhavya has joined #ocaml
<mrvn>
By applying the first argument the value restriction kicks in again.
uris77_ has joined #ocaml
<tobiasBora>
Actually I don't really want that Sys.time () is applyied each time I recall my function
<flux>
tobiasbora, it's easiest to see with references: let foo () = let v = ref None in fun new_value -> let old_value = !v in v := Some new_value; old_value
<flux>
you can determine that it's always safe to call this function
<mrvn>
tobiasBora: you don't. you do: let printf_int = printf (), let printf_float = printf (), ... and each one gets it's own '_a
<tobiasBora>
And I don't understand why does g has a '_a variable, while if I put "5.1" instead of "Sys.time ()" (that have the same type) is doesn't work...
uris77 has quit [Ping timeout: 245 seconds]
<mrvn>
tobiasBora: because a function application can have refs in them
<mrvn>
tobiasBora: e.g. the Sys.time could be like fluxes foo
mort___ has joined #ocaml
<flux>
actually let's go simpler
<mrvn>
tobiasBora: overall the type system isn't smart enough to see that nothing would break in this special case.
<flux>
let bar () = 5;; and let foo = let a = bar () in fun () -> a;;
<flux>
I think we can all agree that calling foo () is safe; no matter what you do, it will return '5'
<flux>
its type is: unit -> int
<flux>
now let's change the definition of bar: let bar () = ref []
<tobiasBora>
yes
<flux>
and re-evaluate the foo function
<tobiasBora>
foo : unit -> 'a list ref
<flux>
without the value restriction, we would now have a function val foo : unit -> 'a list ref
<flux>
how would this be bad?
<tobiasBora>
If later I put
<mrvn>
let x = foo () x := 1::!x x := "foo"::!x
<tobiasBora>
bar := 1; then foo will become unit -> int list ref
<flux>
without the value restriction it will not come that
<mrvn>
tobiasBora: can't do that, bar is a function
<Drup>
tobiasBora: that's the behavior of '_a, but not 'a
<flux>
it would remain polymorphic
<mrvn>
taking unit
kakadu has joined #ocaml
<tobiasBora>
Hum
ptc has joined #ocaml
<mrvn>
Other languages call bar a factory
<tobiasBora>
You mean that you just created a variable of type 'a
<tobiasBora>
?
olauzon has joined #ocaml
<flux>
exactly. though, even if he didn't create such a variable..
ptc is now known as Guest38614
<flux>
it would be the same to do: foo () := [1]; foo () := "foo"::foo();;
Haudegen has joined #ocaml
<flux>
because it's always referring to the same instance
<flux>
but it's a polymorphic value, so it can be anything
arjun has joined #ocaml
<flux>
(actually it's ::!foo())
<flux>
(actually2 it's ::!(foo ()) :-))
arjun is now known as Guest77234
<mrvn>
lets make it simple and say let x = foo ()
<tobiasBora>
Ok I understand :D
<tobiasBora>
He cannot say that (at least this little example)
<tobiasBora>
*
dsheets has quit [Ping timeout: 265 seconds]
<tobiasBora>
s/He cannot say that//g
ericwa has joined #ocaml
<mrvn>
Advanced followup: when I use: type r = { start_time : float; fn : 'a . .... } let printf = let r = { start_time = Sys.time (); fn = ... } in r.fn why is it still '_a? Shouldn't the universality trump the value restriction?
ghostpl_ has joined #ocaml
Guest77234 has quit [Quit: Page closed]
<companion_cube>
I don't think so, you need ... in fun x -> r.fn x
<companion_cube>
when you do r.fn, I think it generates fresh variables, so the value restriction applies
<mrvn>
companion_cube: no. must be earlier when r is created
<mrvn>
if you move r out of the printf then it works.
matason has quit [Quit: Leaving...]
<tobiasBora>
mrvn: flux: Drup: I'm sorry but I have to go, I'm already late. But I will come later, it's not the first time I have such problem and I wan't to understand once and for all...
<tobiasBora>
Thank you for your help !
MrScout has joined #ocaml
MrScout has quit [Remote host closed the connection]
thomasga has joined #ocaml
matason has joined #ocaml
rgrinberg has joined #ocaml
Haudegen has quit [Ping timeout: 255 seconds]
matason has quit [Client Quit]
freling has joined #ocaml
amirmc has quit [Quit: Leaving.]
nullcat has joined #ocaml
govg has joined #ocaml
mort___ has quit [Quit: Leaving.]
nullcat has quit [Remote host closed the connection]
blAckEn3d has joined #ocaml
nullcat has joined #ocaml
reem has joined #ocaml
blAckEn3d has quit [Client Quit]
dsheets has joined #ocaml
reynir is now known as internet
internet is now known as reynir
madroach has quit [Ping timeout: 264 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
idem-pyon-tent has quit [Quit: fix]
pyon has joined #ocaml
madroach has joined #ocaml
reynir is now known as hapcae
wwilly has joined #ocaml
OnkV has joined #ocaml
hapcae is now known as reynir
slash^ has quit [Read error: Connection reset by peer]
wwilly has left #ocaml [#ocaml]
uris77 has joined #ocaml
uris77_ has quit [Read error: Connection reset by peer]
nullcat_ has joined #ocaml
nullcat has quit [Ping timeout: 240 seconds]
freling has quit [Quit: Leaving.]
oriba has joined #ocaml
nullcat has joined #ocaml
nullcat_ has quit [Ping timeout: 272 seconds]
nullcat_ has joined #ocaml
badon has joined #ocaml
nullcat has quit [Ping timeout: 272 seconds]
Anarchos has joined #ocaml
mort___ has joined #ocaml
_andre has quit [Quit: leaving]
govg has quit [Ping timeout: 246 seconds]
matason has joined #ocaml
oriba has quit [Quit: Verlassend]
AlexRussia has quit [Ping timeout: 265 seconds]
<whitequark>
"why is utop called like so" "using utop is pure utopia"
contempt has quit [Ping timeout: 256 seconds]
contempt has joined #ocaml
AlexRussia has joined #ocaml
Denommus has joined #ocaml
freling has joined #ocaml
uris77_ has joined #ocaml
badkins has quit []
uris77 has quit [Ping timeout: 246 seconds]
TheLemonMan has joined #ocaml
freling has quit [Quit: Leaving.]
AlexRussia has quit [Ping timeout: 256 seconds]
boogie has joined #ocaml
AlexRussia has joined #ocaml
nullcat_ has quit [Ping timeout: 246 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
badkins has joined #ocaml
reem has quit [Remote host closed the connection]
<Denommus>
raw OCaml doesn't include an option type, does it?
AlexRussia has quit [Ping timeout: 264 seconds]
<dmbaturin>
Denommus: It does.
<dmbaturin>
type 'a option = None | Some of 'a
<companion_cube>
I was going to say it's defined in the stdlib, but no, it's even tighter because it's used for optional arguments
<Denommus>
dmbaturin: does it have a module for utility functions, like List or Array?
Guest38614 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]