* whitequark
idly wonders if writing a camlp4 preprocessor to add diagnostic literals is a good idea
<MarcWeber>
Which command to use to pipe data through an external command ?
rednovae has joined #ocaml
osnr has quit [Quit: Leaving.]
<demonimin_>
Popen
demonimin_ is now known as demonimin
<MarcWeber>
demonimin: If somebody tells such - how to find the source ?
<MarcWeber>
or the library it contains?
<MarcWeber>
popen_process?
<MarcWeber>
shipping with ocaml in otherlibs/(win32unix/uninx)?
<demonimin>
MarcWeber: I got it wrong, OCaml doesn't map to C for this. Try Unix.create_process.
<MarcWeber>
Yes, I've found that in that file ..
<MarcWeber>
that popen_* stuff was close enough to continue reading.
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
walter has joined #ocaml
montik has joined #ocaml
montik_ has quit [Ping timeout: 240 seconds]
darkf has joined #ocaml
osnr1 has joined #ocaml
osnr has quit [Read error: Connection reset by peer]
walter has quit [Quit: This computer has gone to sleep]
osnr1 has quit [Quit: Leaving.]
ggole has joined #ocaml
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
osnr has quit [Client Quit]
justdit has joined #ocaml
yacks has quit [Read error: Connection reset by peer]
ben_zen has quit [Quit: leaving]
ben_zen has joined #ocaml
yacks has joined #ocaml
pygmalion has joined #ocaml
<pygmalion>
Is there a way to do what I am trying to do here (in two different ways) such that I can access the constructors A and B without going through X_intf?
<pygmalion>
i.e. A.A, A.B and B.A, B.B rather than A.X_intf.A, A.X_intf.B, etc.
<ggole>
Split it up more
<pygmalion>
how so?
<ggole>
Let's see
<ggole>
module type T = sig type t = A | B end
<ggole>
module F = functor (M : T) -> struct
<ggole>
let f = function M.A -> M.B | M.B -> M.A
<ggole>
end
<ggole>
module X = struct
<ggole>
type t = A | B
<ggole>
end
<ggole>
So
<ggole>
At this point you can use X as an argument to your functor
<ggole>
And also include it directly
<ggole>
That "factoring" solves the problem (I think)
<pygmalion>
ggole: Ah, I see. Yes, that works. I'm trying to get as close as possible to not repeating type t too much but still being able to use the constructors.
<ggole>
If it is a large algebraic type, moving it into it's own .ml might be a good idea
<ggole>
It is annoying, but works well
<pygmalion>
The issue is actually that I have many small modules that are all identical except for a type t and I was hoping to use a functor to reduce that repetition but am finding that the functor doesn't actually get me that much more since in order to access the constructors of the type t I need to redefine the functor each time.
<pygmalion>
err, "would need to redefine..."
<ggole>
Hmm
<pygmalion>
am I missing something or is there just no good way to use functors unless you are dealing with abstract types?
<ggole>
There is some visibility machinery which lets you fix that
<ggole>
Er, I have to look up the syntax every time. One moment.
<pygmalion>
Sure, thanks!
<ggole>
OK
<ggole>
Going by the example in the docs you name a signature type as the result type of your functor
f[x] has quit [Ping timeout: 256 seconds]
<ggole>
Then you can say with type x = y, expressing the equivalence you want
weie_ has joined #ocaml
<pygmalion>
Can you link me to the docs or give an example? I'm not sure I understand, sorry.
<ggole>
Yeah, sec
<ggole>
(It's complicated: I don't understand all the bits, to be honest)
caligula has quit [Quit: Konversation terminated!]
caligula has joined #ocaml
ben_zen has quit [Ping timeout: 248 seconds]
pygmalion has quit [Ping timeout: 256 seconds]
mika1 has joined #ocaml
pootler has quit [Ping timeout: 246 seconds]
Simn has joined #ocaml
cago1 has joined #ocaml
mcclurmc has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
ocp has quit [Quit: Leaving.]
mort___ has joined #ocaml
ontologiae has joined #ocaml
Snark has joined #ocaml
pygmalion has joined #ocaml
testcocoon has quit [Read error: Connection reset by peer]
osa1 has joined #ocaml
testcocoon has joined #ocaml
pygmalion has quit [Ping timeout: 240 seconds]
ttamttam has joined #ocaml
caligula_ has joined #ocaml
caligula has quit [Ping timeout: 264 seconds]
cago1 has quit [Quit: Leaving.]
weie_ has quit [Quit: Leaving...]
milosn_ is now known as milosn
weie has joined #ocaml
lusory_ has quit [Quit: leaving]
zpe has joined #ocaml
mcclurmc has quit [Ping timeout: 248 seconds]
zpe has quit [Remote host closed the connection]
pygmalion has joined #ocaml
ollehar has joined #ocaml
<introom_>
Hi, I've installed opam, any nice solution to make it opam config -env be automatically exported?
<gasche>
introom_: there is a shell script installed along opam that does that
<gasche>
opam-switch-eval
<gasche>
defined in $OPAM/opam-init/switch_eval.sh
<introom_>
how do I modify my .zshrc?
<introom_>
currently, it only has . /Users/eddie/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
<gasche>
that should be enough
<introom_>
but that doesn't export the path, so I have to run eval `opam config -env ` to export the PATH
thomasga has joined #ocaml
<gasche>
can you call "opam-switch-eval foo" from a terminal that has loaded init.zsh through you .zshrc?
<introom_>
to let utop to be found in $PATH
<introom_>
yeah
<gasche>
so, problem solved
<introom_>
?
<introom_>
I want to init.zsh to automatically export the path, `which opam-switch-eval` is just a function so I can directly access it.
pygmalion has quit [Ping timeout: 246 seconds]
<introom_>
The problem is that I dunno I should dirty hack it or opam has the ability to support that
<gasche>
init.*sh should export the PATH already
<gasche>
and using opam-switch-eval instead of "opam switch" should re-export the correct variables after switching
introom has joined #ocaml
introom_ has quit [Ping timeout: 264 seconds]
<introom>
gasche: yeah. looked at the varialbes.sh, it doesn't export /Users/eddie/.opam/**4.01.0dev+trunk**/bin, just export /Users/eddie/.opam/system/bin:$PATH
<introom>
gasche: what's the system/bin for? Is it possible to make opam export /Users/eddie/.opam/**4.01.0dev+trunk**/bin directly?
<gasche>
if you want 4.01.0dev+trunk to be the default opam switch, you could add a "opam-switch-eval 4.01.0dev+trunk" line to your .zshrc
<gasche>
I'm not sure how OPAM decides which default version to have in variables.sh
<gasche>
(this could probably be changed; is it in OPAm's documentation?)
<gasche>
introom: but do you really think it is wise to set an unstable trunk version as your default OCaml installa?
<gasche>
that seems absolutely crazy to me
<introom>
gasche: new to this, I was just following "real world ocaml"
<gasche>
hm
<introom>
and the book uses that.
<gasche>
we should break the trunk build so that people stop doing that
<gasche>
avsm: why does RWO advise to use 4.01.0dev+trunk? Couldn't you make a stable alias with -short-path?
<introom>
gasche: utop warns about #use "topfind" Error: Unbound value use
<kaustuv>
Why does RWO push utop so much anyway?
<introom>
kaustuv: any clue as to my problem ^
<thomasga>
introom: you're missing the OCAML_TOPLEVEL_PATH env variable
<thomasga>
seems you're screwed up your OPAM settings
<thomasga>
ha
<thomasga>
sorry
<introom>
echo $it i get:/Users/eddie/.opam/4.01.0dev+trunk/lib/toplevel
<introom>
thomasga: for what?
<thomasga>
I remove that :p
<thomasga>
you need to write the #
<thomasga>
#use
<introom>
thomasga: and also for #require ?
<thomasga>
indeed
f[x] has joined #ocaml
Yoric has joined #ocaml
<introom>
it works.
introom has quit [Remote host closed the connection]
lusory has joined #ocaml
so has joined #ocaml
wagle_ has joined #ocaml
Derander_ has joined #ocaml
hyperbor1ean has joined #ocaml
mcclurmc has joined #ocaml
adrien_ has joined #ocaml
hyperboreean has quit [*.net *.split]
wagle has quit [*.net *.split]
adrien has quit [*.net *.split]
Derander has quit [*.net *.split]
Sim_n has joined #ocaml
mcclurmc has quit [Ping timeout: 246 seconds]
Simn has quit [Ping timeout: 276 seconds]
mcclurmc has joined #ocaml
<hcarty_>
Has anyone here had success with ocaml-top and Windows 8? I'm trying it out as a potential demo for some colleagues but the ocaml-top interface becomes unresponsive after running any code.
<hcarty_>
This is with the ocaml-top recommended Windows installer for OCaml (installing the 'OCaml' portion only) on a 64bit Windows 8 installation and ocaml-top 1.0.0.
zpe has joined #ocaml
hcarty_ is now known as hcarty
Sim_n is now known as Simn|gone
zpe has quit [Ping timeout: 264 seconds]
pygmalion has joined #ocaml
pygmalion has quit [Ping timeout: 240 seconds]
<pippijn>
whitequark: I would like to have merr under GPL
<pippijn>
whitequark: but the support library under MPL
<pippijn>
whitequark: and the generated code under MPL
<pippijn>
whitequark: would that be ok with you?
ontologiae_ has joined #ocaml
ontologiae has quit [Read error: Connection reset by peer]
<pippijn>
whitequark: I don't know how code generation tools are usually licensed
* pippijn
checks bison
AltGr has joined #ocaml
<AltGr>
I heard there were questions about ocaml-top ?
<pippijn>
ok, the bison skeleton is gpl
<AltGr>
I'll be glad to answer them
<rks`_>
AltGr: ping hcarty
<Drup>
AltGr: do you plan to have utop-like autocompletion ?
dsheets has quit [Ping timeout: 248 seconds]
quelu has quit [Read error: Operation timed out]
<AltGr>
Drup: not that advanced
sgnb has quit [Read error: Connection reset by peer]
<AltGr>
but simple completion is planned
sgnb has joined #ocaml
<AltGr>
(ie completing from the standard library, and showing types)
snearch has joined #ocaml
<Drup>
ok
<Drup>
just what ocp-index can handle, right ?
<AltGr>
exactly :)
<AltGr>
Actually the code is already there, but completion was disabled because the completion widget sometimes segfaults
<Drup>
that's inconvenient :D
<pippijn>
whitequark: generated code should be unlicensed
<pippijn>
whitequark: the tool GPL, the support library MPL, the code whatever people want
q66 has joined #ocaml
<hcarty>
AltGr: ocaml-top stops responding for me after running code once. This is under Windows 8, OCaml 4.00.1 using the installer recommended on the ocaml-top site.
quelu has joined #ocaml
<hcarty>
AltGr: For what it's worth, I did not have this problem with ocaml-top under Ubuntu + opam
dsheets has joined #ocaml
<hcarty>
AltGr: To be more precise - the buttons in the GUI stop responding.
<AltGr>
hcarty: some problems have been reported with win8
<AltGr>
I am now installing a VM to do more thorough testing
<AltGr>
Drup: that's the joy of working with GTK :)
<AltGr>
hcarty: process management on Windows is a mess, and to make it worse it seems that it changes between versions...
zpe has joined #ocaml
<mrvn>
Under linux ocaml can't even kill a thread. How much worse can it be?
<mrvn>
On that note: Ideas how to wake up a thread stuck in select so it can terminate and the programm can end?
<f[x]>
killing threads is bad idea either way
<f[x]>
send a signal to that thread?
<AltGr>
mrvn: well you can't either
<mrvn>
f[x]: how?
<mrvn>
I see Thread.wait_signal but no Thread.send_signal
<AltGr>
and sending SIGINT to ocaml to stop current computation is really tedious
<hcarty>
AltGr: That sounds like no fun at all.
<f[x]>
signal with thread pid should do
<f[x]>
but it can be delivered to another thread anyway
<f[x]>
so you probably want to repeat that several hundred thousands times
<mrvn>
f[x]: where do I get the pid for a Thread.t?
<f[x]>
hm, and if it is new code - than just add one more fd to select?
<mrvn>
f[x]: yeah, I thought about adding a kill pipe.
<f[x]>
that's the cleanest solution
<f[x]>
concerning thread pids - I guest a binding is needed for _SYS_gettid
<f[x]>
or smth like that
<f[x]>
* guess
<f[x]>
or block signal processing on all threads except this one and send signal to self as usual
<f[x]>
that all gets ugly beyond bearing :)
<mrvn>
I only have 2 threads. One for SDL, one for select()
<f[x]>
I would go eventfd/killpipe route any time of day
<mrvn>
Stupid SDL has no way to include FDs in its event loop so I have to make my own for sockets.
<f[x]>
that's cruel
<f[x]>
it is the lib from what century? XIX?
<mrvn>
last millenium I'm sure
<kaustuv>
on linux you can use signalfd to have a common select for signals and fd state changes
_andre has joined #ocaml
<mrvn>
I only need to terminate the select call. A pipe or socket pair will do there.
<aggelos__>
I'm not sure how that would "allow writing unsafe programs"
<aggelos__>
sure, the .t types look are the same, but as far as the type system is concerned you can only access them through functions included in the common sig
<aggelos__>
so I'm not sure what would be unsafe there
<aggelos__>
(though I understand there'd be a need for runtime support)
<aggelos__>
what am I missing?
<mrvn>
aggelos__: couldn't you do let f = N.access_function in r := other_module; f !r?
<mrvn>
aren't M.t and N.t in that slide different because each application of F(A) gives a unique type?
<kaustuv>
this looks like the standard example of the need for the value restriction
mcclurmc_laptop has joined #ocaml
<kaustuv>
the issue is that what "F(A)" means can change between different occurrences of it in the program if we allowed the body of a functor to be an unpacked first class module, but the soundness of the type system depends on "F(A)" always standing for the same module
<aggelos__>
mrvn: but N : S, no? so any such access function should be in other_module too
mcclurmc has quit [Read error: Operation timed out]
<aggelos__>
kaustuv: right, that's my question. given that the unpacked thing always obeys the same sig, isn't it still sound?
<mrvn>
aggelos__: but one is an int and the other a float
<kaustuv>
no, because if you ran M.t = N.t then you would get a runtime crash as you would be comparing a float and an int
<aggelos__>
kaustuv: alright, so the sig doesn't limit equality comparison
<aggelos__>
if that's the case, I can see the problem :)
<aggelos__>
right, cause (=) is 'a -> 'a -> bool
<aggelos__>
k, thanks!
<kaustuv>
actually to get the crash you need to be a bit crafty. Maybe something like: (Array.make 10 N.x).(0) <- M.x
<whitequark>
pippijn: yes it's OK for me
<aggelos__>
hmm. this still means I can't do the thing described in slide number 7 in the same presentation when functors are involved :/
<kaustuv>
no, you can use functions to make new modules, not *functors*. The names of functors are part of the type system.
<pippijn>
whitequark: ok
mcclurmc_laptop is now known as mcclurmc
<aggelos__>
kaustuv: hmm, is there an example of a dynamic algorithm factory function in existing code somewhere?
<aggelos__>
I've already spent half of yesterday on this and my deadline is only getting closer :)
<aggelos__>
(I'm thinking about an existing project, not an example per se)
Simn|gone is now known as Simn
introom has joined #ocaml
<aggelos__>
mm. tangential question: can I derive the sig of the module that I get from a functor application, from the signature of the functor?
<mrvn>
like apply the functor sig to the module sig?
<aggelos__>
yah
<mrvn>
If the functor is M -> S then you can use something like S with type t = M.t
<kaustuv>
aggelos__: module type S = module type of Set.Make(String);;
<kaustuv>
requires 4.00.1+
mye has quit [Quit: mye]
<kaustuv>
you can also say "module type of Set.Make" to get the signature of the Set.Make functor
<mrvn>
or # module type M = Set.S with type elt = string;;
<aggelos__>
kaustuv: ah. thanks a lot (stuck with 3.12 for now)
<kaustuv>
at least upgrade to 3.12.1
<kaustuv>
3.12.0 is dangerous
<aggelos__>
right, using the 3.12.1 in debian
<aggelos__>
(what's dangerous about 3.12.0?)
<kaustuv>
lots of stuff -- see /usr/share/doc/ocaml-nox/changelog.gz
<aggelos__>
kaustuv: thanks again
Enjolras has joined #ocaml
<gasche>
aggelos__: you can represent your plugin not as a module, but as a record, using (from 4.00) GADTs for existential types if you need some
<MarcWeber>
Does ocaml on windows always require a /bin/sh environment ?
Snark has quit [Ping timeout: 264 seconds]
pygmalion has joined #ocaml
<mrvn>
gasche: you can use a nested record instead of GADTs
<kaustuv>
MarcWeber: what shell does Sys.command run in Windows?
<gasche>
mrvn: there are unpalatable runtime and readability costs
<MarcWeber>
I've no idea which is why I'm asking ..
<MarcWeber>
I'm trying to understand whether shell scripts to use cppo and camlp4 are portable
<gasche>
probably not, but an OCaml program would be
<gasche>
I think someone has already implemented a tool to pipe preprocessors
<kaustuv>
looking at asmrun/sys.c, it caml_sys_system_command just calls system(3) -- so it's whatever it is in Windows. I would imagine that it would not use /bin/sh.
osa1 has quit [Ping timeout: 246 seconds]
<kaustuv>
aggelos__: actually, module type of is in 3.12.1 already
<kaustuv>
sorry, I misremembered
paolooo has joined #ocaml
paolooo has quit [Ping timeout: 250 seconds]
Snark has joined #ocaml
Zeev has quit [Remote host closed the connection]
walter has joined #ocaml
thomasga has quit [Quit: Leaving.]
Snark has quit [Ping timeout: 264 seconds]
Snark has joined #ocaml
pygmalion has joined #ocaml
Neros has joined #ocaml
<aggelos__>
kaustuv: kk, will try to use it in a bit
pygmalion has quit [Ping timeout: 248 seconds]
Arthur_ has joined #ocaml
Leonidas_ has joined #ocaml
zorun_ has joined #ocaml
iZsh` has joined #ocaml
Cypi_ has joined #ocaml
rossberg_ has joined #ocaml
fds_ has joined #ocaml
ipoulet_ has joined #ocaml
Cypi has quit [Disconnected by services]
Cypi_ is now known as Cypi
SuperNoeMan_ has joined #ocaml
Neros has quit [*.net *.split]
Arthur__ has quit [*.net *.split]
PM has quit [*.net *.split]
zorun has quit [*.net *.split]
iZsh has quit [*.net *.split]
jave has quit [*.net *.split]
SuperNoeMan has quit [*.net *.split]
Leonidas has quit [*.net *.split]
fasta has quit [*.net *.split]
fds has quit [*.net *.split]
rossberg has quit [*.net *.split]
stomp has quit [*.net *.split]
ipoulet has quit [*.net *.split]
SuperNoeMan_ is now known as SuperNoeMan
jave has joined #ocaml
stomp has joined #ocaml
zorun_ is now known as zorun
dezzy has quit [Read error: Connection reset by peer]
dezzy has joined #ocaml
PM has joined #ocaml
dezzy has quit [Changing host]
dezzy has joined #ocaml
osa1 has joined #ocaml
stomp has quit [Ping timeout: 245 seconds]
stomp has joined #ocaml
smondet has joined #ocaml
caligula__ has joined #ocaml
mika1 has quit [Quit: Leaving.]
ttamttam1 has joined #ocaml
rossberg__ has joined #ocaml
Snark_ has joined #ocaml
Derander has joined #ocaml
fds has joined #ocaml
q66_ has joined #ocaml
iZsh has joined #ocaml
UncleVasya has joined #ocaml
paolooo has joined #ocaml
Arthur_ has quit [Read error: Connection reset by peer]
Arthur_ has joined #ocaml
chris2 has quit [Quit: Lost terminal]
chris2 has joined #ocaml
travisbrady has joined #ocaml
fds_ has quit [*.net *.split]
rossberg_ has quit [*.net *.split]
iZsh` has quit [*.net *.split]
Snark has quit [*.net *.split]
q66 has quit [*.net *.split]
Derander_ has quit [*.net *.split]
Yoric has quit [*.net *.split]
caligula_ has quit [*.net *.split]
ttamttam has quit [*.net *.split]
lopex has quit [*.net *.split]
ben_zen has joined #ocaml
thelema has joined #ocaml
caligula_ has joined #ocaml
TaXules_ has joined #ocaml
nicoo_ has joined #ocaml
bholst_ has joined #ocaml
jeremie has joined #ocaml
samebcha1e has joined #ocaml
q66_ is now known as q66
Nahra_ has joined #ocaml
ChanServ has joined #ocaml
fasta has joined #ocaml
ttamttam1 has quit [Remote host closed the connection]
fasta has quit [Ping timeout: 264 seconds]
nicoo_ has quit [Changing host]
nicoo_ has joined #ocaml
ChanServ has left #ocaml []
ttamttam has joined #ocaml
ollehar has quit [Remote host closed the connection]
jave_ has joined #ocaml
ollehar has joined #ocaml
IbnFirnas has quit [Read error: Operation timed out]
caligula__ has quit [*.net *.split]
jave has quit [*.net *.split]
nicoo has quit [*.net *.split]
redfire has quit [*.net *.split]
Nahra has quit [*.net *.split]
jdoles has quit [*.net *.split]
samebchase has quit [*.net *.split]
brendan has quit [*.net *.split]
bholst has quit [*.net *.split]
spearalo1 has quit [*.net *.split]
thelema_ has quit [*.net *.split]
Asmadeus has quit [*.net *.split]
amiller has quit [*.net *.split]
TaXules has quit [*.net *.split]
osa1 has quit [Quit: Konversation terminated!]
ggherdov has quit [Ping timeout: 264 seconds]
amiller_ has joined #ocaml
Asmadeus has joined #ocaml
brendan has joined #ocaml
thomasga has joined #ocaml
spearalot has joined #ocaml
bondar has joined #ocaml
bondar has quit [Excess Flood]
bondar has joined #ocaml
bondar has quit [Excess Flood]
bondar has joined #ocaml
bondar has quit [Excess Flood]
bondar has joined #ocaml
bondar has quit [Excess Flood]
introom has quit [Remote host closed the connection]
kaustuv has left #ocaml []
IbnFirnas has joined #ocaml
Snark_ has quit [Read error: Operation timed out]
ggherdov has joined #ocaml
eikke has joined #ocaml
AltGr has quit [Ping timeout: 248 seconds]
f[x] has joined #ocaml
lopex has joined #ocaml
<aggelos__>
gasche: I'm not 100% sure on how to do that, do you perhaps have a good example in mind (in existing source code)?
AltGr has joined #ocaml
ttamttam has quit [Remote host closed the connection]
ttamttam has joined #ocaml
lopex is now known as Guest55349
ben_zen is now known as Guest69149
jdoles has joined #ocaml
Guest69149 has quit [Quit: off I go!]
<gasche>
aggelos__: I flushed our past conversation from my memory; can you provide a bit of context on what were were discussing?
justdit has joined #ocaml
bondar has joined #ocaml
bondar has quit [Excess Flood]
bondar has joined #ocaml
bondar has quit [Client Quit]
madroach has quit [Ping timeout: 248 seconds]
osnr has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
<whitequark>
argh
<whitequark>
screw undefined evaluation order
<whitequark>
now my code is littered with lets
<adrien_oww>
what did it have before?
<adrien_oww>
and?
<flux>
adrien_oww, expressions
<whitequark>
name :: args -> bind name @ bind_rest_of_args args
<whitequark>
(simplified)
<whitequark>
bind has side effects.
<flux>
it's ok to have side effects in that context, but apparently the order of side effects mattered to you?-)
<whitequark>
specifically, it adds the name to static environment, and if it's already there, produces a diagnostic
<whitequark>
and if diagnostic for a variable bound twice says that the *first* occurence is the erroneous one... you have problems :D
<gasche>
if a function does observable side-effects, it's probably best to compute it at a precisely-defined time indeed
<AltGr>
hcarty: I finally got a win 8 set up
<whitequark>
gasche: it even visibly breaks with native builds
<AltGr>
and I can't reproduce
<gasche>
but in your case, it is probably a design mistake in your code that this would be an issue
<whitequark>
so you're saying I should model static environment as immutable and pass it around
<gasche>
I don't know
<whitequark>
well, that would get rid of the issue
<gasche>
I think it is reasonable to have global side-effects in an unspecified order if they commute nicely
<hcarty>
gasche: From what I've seen, ocaml-top + merlin would be quite a wonderful beginner's tool.
<gasche>
whitequark: did you consider stacking the error messages in a mutable stack, instead of returning a list?
<gasche>
your code makes me wonder what information is getting lost because of the (ignore (bind ...); ...)
<gasche>
I think it would be both easier to read, and actually more consistent, if it was "all effectfull" (or all pure, of course)
<whitequark>
gasche: (ignore) is deliberate
<whitequark>
for example, consider a lambda "(x, *y, z, t) {}"
<whitequark>
regular arguments can't follow rest arguments; so it displays an error on "z"
<gasche>
isn't there a way to implement the same intent while being more explicit, which would make it easier for other people to read your code?
<whitequark>
but it doesn't give you anything to display another error on "t"
* whitequark
nods
<whitequark>
I will convert it to an FSM, later
<whitequark>
but that's unrelated to ignoring errors
<whitequark>
I think it's very explicit: I want to ignore them, hence I do
<whitequark>
probably needs a comment
ttamttam has quit [Ping timeout: 260 seconds]
<whitequark>
though maybe it is... if there's a default value afterwards, and there's an error in expression defining that value, that error will get ignored as well
<whitequark>
well, FSM would solve that as well
<gasche>
why do some errors lead to ignoring future errors, and some others (those in bind) don't?
<hcarty>
Although from what I've seen, everything is better with merlin.
ttamttam has joined #ocaml
<gasche>
in fact whitequark you report the "already bound" errors only upto the first optional/rest error
<gasche>
isn't that a bug?
<whitequark>
yeah, same as what I just described
<gasche>
ok
<gasche>
so you should have a separate stack for these two kinds of errors, instead of conflating them in a single list
<whitequark>
why stacks? I never pop them
<gasche>
multiple-bind errors would get stacked into a ('a list) (to eventually reverse), while optional/rest errors would be stacked into a ('a option) value (only the first one is kept, others are ignored)
<whitequark>
ah, in this sense
<whitequark>
yes, that's what I should do.
<gasche>
then you can have "env" be an explicit input and return value of your code
<gasche>
and what you have is only a List.fold_left
<gasche>
without the strange code, the order-evaluation bugs, and the headaches
<gasche>
(you can also keep side-effecting the global binding table, and purely-collecting errors, but I find this to be a bit dubious stylistically)
ttamttam has quit [Ping timeout: 268 seconds]
<aggelos__>
gasche: 14:12 < gasche> aggelos__: you can represent your plugin not as a module, but as a record, using (from 4.00) GADTs for existential types if you need some
<gasche>
ah
<gasche>
I have to leave now but
<aggelos__>
gasche: I was asking if you know of an example for that
<gasche>
quickly
<gasche>
the main difference between record of functions and modules is that modules also carry type-level information
<gasche>
"private types", or partially private types
<aggelos__>
right
<aggelos__>
records expose all types
<gasche>
this is useful if some functions of the exposed interface need to talk about internal values whose representation the user doesn't know
<gasche>
(though in a lot of cases you don't actually need to mention those types in the interface)
<gasche>
(case in point, (sig type t val arg : t val apply : t -> foo) is actually equivalent to { apply : unit -> foo })
<gasche>
GADTs provide existential types and equalities between types; existential types are another way (than module interfaces) to represent those "abstract types"
<gasche>
type gadt_blah = Foo : 't record_of_function -> gadt_blah
<gasche>
the 't type is now hidden, just like the abstract type (t) in the module signature
<gasche>
but you have to know that
<gasche>
(1) GADTs are an expert feature and have really shitty error messages (2) the form of modularity provided by ML modules is not the same, from a usability point of view, as the one of records + existential types
<aggelos__>
hmm
<gasche>
(it is from an expressivity point of view)
mrvn has quit [Ping timeout: 246 seconds]
<gasche>
also GADTs are a version-4.00 feature, so if you're stuck with 3.12.x, you're out of luck anyway
<aggelos__>
gasche: alright, thanks, gonna have to read that a few times
<gasche>
feel free to read the part of the OCaml manual on GADTs, it is actually reasonably good
<aggelos__>
yah, stuck with 3.12 atm, as moving to 4.0 would mean upgrading the framework I'm using, which would lead to other issues
<aggelos__>
gasche: if only to see what I'm missing, yup :)
<gasche>
(but they're generally used for other things than just getting existential types for free, so the examples there may not relate to this discussion a lot)
<AltGr>
gasche (on ocaml-top): Merlin integration would sure be cool ; but for this version we wanted to keep things simple and be able to run directly any external toplevel
<gasche>
leaving for a few days of holidays, anyway
<AltGr>
that limits the interactions you can do a lot
<aggelos__>
gasche: enjoy
<AltGr>
but makes it more general
ttamttam has joined #ocaml
mrvn has joined #ocaml
rwmjones has quit [Read error: Operation timed out]
ttamttam has quit [Remote host closed the connection]
ttamttam has joined #ocaml
travisbrady has quit [Quit: travisbrady]
ttamttam has quit [Client Quit]
rwmjones has joined #ocaml
AltGr has quit [Quit: leaving]
ontologiae_ has quit [Read error: Operation timed out]
eikke has quit [Ping timeout: 245 seconds]
darkf has quit [Quit: Leaving]
mcclurmc has quit [Ping timeout: 246 seconds]
tianon has quit [Read error: Operation timed out]
tianon has joined #ocaml
dsheets has quit [Ping timeout: 246 seconds]
justdit has quit [Ping timeout: 264 seconds]
<whitequark>
so I wrote this:
<whitequark>
let [Int(lhs); Int(rhs)] = exprs in
<whitequark>
Int(lhs + rhs)
<whitequark>
and ocaml warns me of non-exhaustive pattern matching
<whitequark>
what if I told it that it's exactly what I want?
<nicoo_>
whitequark: You cannot say "exprs is a 2-elements list" at the type-level in OCaml
<whitequark>
uh. that is, how to tell it so, preferably in the scope of a single file (I'm going to have a *lot* of these)
<whitequark>
nicoo_: I don't need to
<nicoo_>
But you can make exprs a tuple.
<whitequark>
I just want it to assert
<whitequark>
without writing out match..assert explicitly each time
<whitequark>
I'm completely fine with the current *behavior*. I just don't want the warning, which IMO doesn't make much sense for let anyway
<whitequark>
(unlike match)
<nicoo_>
whitequark: Well, if the (implicit) match fails, you get an exception
<whitequark>
nicoo_: yes, that's what I want
<nicoo_>
You can suppress the warning using the compiler's CLI flags, if you really want to.
<nicoo_>
But I don't see why you believe that the warning doesn't make sense for let, though.
<whitequark>
well, maybe it does in general case
<nicoo_>
The flag for suppressing the warning should be "-w p".
* nicoo_
might be wrong though: he doesn't mess often with warnings.
Drup has quit [Ping timeout: 248 seconds]
<gasche>
whitequark: you should write something like
<gasche>
let lift_int op = function [Int(lhs); Int(rhs)] -> Int(op lhs rhs) | _ -> failwith "..."
<gasche>
and then reuse it in several places
<whitequark>
hmm
<whitequark>
I may just as well segregate primitives by their arity
<gasche>
(of course a more structured error than "failwith" would be preferable)
<whitequark>
and make that a tuple
<gasche>
you can do that as well, yes
<whitequark>
wouldn't tuples also be faster than lists in this context?
<gasche>
but then you enforce this kind of checking earlier, probably at parse time
<whitequark>
not sure if measurably so, though
<whitequark>
yes, I already have arity checks in my parser
<gasche>
if you know the size statically, tuples are better tha lists
Uvs has joined #ocaml
<whitequark>
that would include some manually written dispatch tables
<gasche>
but you should consider having combinators that do (dynamic) type-checking and value-extraction at the same time
<whitequark>
why?
<whitequark>
let (Int(lhs), Int(rhs)) = exprs in
<whitequark>
Int(lhs + rhs)
<whitequark>
is completely fine
<whitequark>
if something except Int arrives at that point, it's a completely unrelated bug
<whitequark>
that should have been caught at the earlier point in the interpreter/compiler
<gasche>
why did that earlier point not refine the static guarantees on "exprs", then?
<gasche>
if you statically know that you will get an Int, there is no point in having an Int constructor here (which is meant to distinguish the value from other possibilities)
UncleVasya has quit [Ping timeout: 240 seconds]
<whitequark>
uh... because I want a (relatively) decoupled Primitive module
<whitequark>
arity I can easily check statically, since my syntax doesn't allow to call primitives with non-syntactically-defined arity
<whitequark>
but types, I cannot
<gasche>
decoupled from the type-checker?
<whitequark>
yep.
<mrvn>
let lift : type a . Op.t -> a Exp.t -> a Exp.t -> a Exp.t = function lhs rhs -> match (lhs, rhs) with (Int x, Int y) -> Int (op x y) | ....
<gasche>
whitequark: then I think you should consider the possibility of runtime type failure here
<gasche>
and do things properly
ollehar has quit [Remote host closed the connection]
<gasche>
(that would also allow you to inject non-type-checked code in your interpreter and still have sane errors, which can be handy)
<whitequark>
gasche: primitives are not part of the language. if you call them, it's either stdlib (which checks types itself), or it's your own problem
<whitequark>
the interpreter has its own typechecking facilities... so as long as you never directly call primitives with wrong arguments, you'll never get an error there
ollehar has joined #ocaml
<gasche>
you could still have fun with eg.
<gasche>
wrap (func (tup int int) int) (+)
<whitequark>
say Integer#+ isn't a primitive
<whitequark>
it's a method with signature Integer (Integer) -> Integer
<gasche>
(maybe the order of arguments for `wrap` should be reversed)
ttamttam has joined #ocaml
ttamttam has quit [Client Quit]
<whitequark>
that's handy, since methods/closures have much more moving parts than primitives... eg argument parsing
<whitequark>
it's convenient to have all that machinery in one place (the language itself), and only call invokeprimitive when you're completely sure what you're going to call, with which arguments, etc
<whitequark>
similarly primitives aren't first class.
<orbitz>
gasche: it's an active decision, although there has been talk on the mailing list about this and it soudns like Core_extended will get a Stream api
<samebchase>
What is the idiomatic way of printing the numbers between, say 1 to 10?
<gasche>
Enum has downsides (maybe something like LazyList, or Jérémie Dimino's Seq module, or companion_cube iterators, would be a better starting point)
<whitequark>
there's also Extlib enums
<orbitz>
samebchase: I don't think there is one, it's not really a problem that is solved enough to deseve an idiom
<samebchase>
without using for or while
<gasche>
samebchase: a for loop, I'd say
<gasche>
then recursion as you do
<gasche>
orbitz: is there a reason recorded somewhere for not having a lazy sequence library?
<orbitz>
You can make a range function that gives you back a Stream.t if you really want
<samebchase>
gasche: I was surprised to know that a you can't iterate by an increment other than 1 in a for loop
<mrvn>
let rec loop = function 11 -> () | x -> Printf.printf "%d " x; loop (x+1) in loop 1
<gasche>
(other than "we're obsessed with performance")
<orbitz>
gasche: Jane St feels it's generally not a good solution to problems in ocaml so they don't use them, sothey simply have never made it to Core
<gasche>
hm
<orbitz>
I think a good hunk o ftheir code is in Async too, which has Pipe, which they argue is superior in the face of errors
<orbitz>
How exceptiosn propogate through streams can be confusing (they argue)
<gasche>
since the last time I looked at Core, it grew a ton of small arcane performance-justified modules
<mrvn>
exceptions with async stuff seems like a bad idea. Better to use an option type imho
<gasche>
this discussion leaves me less convinced than I previously was that it is a good option for beginners
ontologiae_ has joined #ocaml
<orbitz>
mrvn: Async has reasonable support for exceptions (I prefer to use Result.t though)
<samebchase>
so everytime I want to iterate I'd have to write ad-hoc 'loop' functions?
<orbitz>
gasche: I haven't noticed that in Core, but I like to believe I'mnot a beginner
<orbitz>
samebchase: Depends on what you want to iterate over
<orbitz>
I rarely need to count in my Ocaml programs
<orbitz>
Usually I iterate over *something*
<mrvn>
samebchase: more often you have something to iterate over, like List.iter (Printf.printf "%d ") [1;2;3;4]
<samebchase>
of course, but wouldn't it be faster, in this case to do arithmetic iteration?
<orbitz>
Ocaml is fast enough
<mrvn>
samebchase: for
<mrvn>
samebchase: while
<orbitz>
Iterating over lists is significnatly safer
<orbitz>
for many things
<orbitz>
iterating over something, I should say
<gasche>
besides, making "for" more complex to avoid using the more expressive recursive functions is a bit dangerous
<gasche>
today you add fixed increments
<gasche>
tomorrow people ask for an arbitrary stop predicate
<companion_cube>
my Sequence library is there to make iteration composable ;)
<gasche>
and there you are, writing a recursive loop in ad-hoc syntax
<orbitz>
samebchase: if you're concerned about performance, please demonstarte an actual performance bottleneck in your code, otherwise you should use the highlevel, safe, idioms
<samebchase>
orbitz: hm.
<gasche>
C compilers do strength reduction all the time
<gasche>
(replacing multiplication of an incremented-by-one loop index by a larger increment)
<gasche>
I don't think OCaml compiler bothers to do that
<samebchase>
I will check out the suggested library solutions.
<gasche>
but that would definitely become an option, would people start to observe important performance gains in this direction
<mrvn>
ocaml doesn't optimize
<mrvn>
you get what you write
<orbitz>
The compiler you mean?
<mrvn>
yes
<orbitz>
it does some optimizations
<orbitz>
just not many
<mrvn>
it inlines but that is about it
<nicoo_>
samebchase: PE1 can be easily solved analytically (by computing the sum of the multiples of 3, 5 and 15 for instance), fwiw
<orbitz>
it will also avoid creating tuples in some cases
<companion_cube>
is the C-- stage compatible with other compilers?
<orbitz>
Janestreet has a perforamnc epage that covers some of the otpimizations it does and how to write more performant code
nicoo_ is now known as nicoo
<nicoo>
orbitz: Link ?
<companion_cube>
like using Result.t instead of exceptions? :]
<nicoo>
Ok, ocaml-perf-notes
<mrvn>
On the othe rhand gcc does e.g. common subexpression elimination.
* nicoo
didn't remember it was JaneStreet's.
<orbitz>
bear in mind, this is for performance sensitive code. Most ocaml code doesn't need this
<mrvn>
dsheets: that is the generic one from the GC. I was wondering if classes had a special one
<mrvn>
The opposite of "initializer"
paolooo has quit [Quit: Page closed]
<dsheets>
ah, sorry, i read "objects" as "values"
<dsheets>
or "things that inhabit types"
<dsheets>
mrvn, is there something wrong with setting a finaliser on self in an initializer?
<mrvn>
initializer Gc.finalise (fun x -> x#quit) self
<mrvn>
Compiles fine. But is that corect?
<mrvn>
Shouldn't cause a self reference and keep the object alive forever, right?
wozzz has joined #ocaml
<dsheets>
mrvn, that would make finalisers fairly worthless wouldn't it? You can create an object, lose a ref to it and the force a collection (and print to stdout and flush stdout in #quit) to test
<mrvn>
"Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:
<mrvn>
let v = ... in Gc.finalise (fun x -> ...) v
<mrvn>
"
<mrvn>
I'm calling Gc.finalise from inside the object so the object should be reachable.
wozzz has quit [Read error: Connection reset by peer]
<dsheets>
mrvn, then define the finalisation function outside the scope of self
<dsheets>
its argument will still be of type of self but it will not contain self in its closure
<mrvn>
That seems to crash the GC
osa1 has joined #ocaml
smondet has quit [Read error: Connection reset by peer]
<dsheets>
code?
<mrvn>
trying to simplify it
ontologiae_ has quit [Ping timeout: 248 seconds]
walter has quit [Read error: Connection reset by peer]
walter has joined #ocaml
<mrvn>
#require "unix";;
<mrvn>
let (rd, wr) = Unix.pipe() in Unix.close rd; Unix.write wr "foo" 0 3
<mrvn>
Kills the ocaml runtime
<flux>
it's probably SIGPIPE
<mrvn>
Shouldn't that throw some exception instead?
<flux>
you're writing to a pipe that has no other end
<flux>
well, it doesn't
<flux>
it is a unix signal
<flux>
but you can probably get an exception by seting SIGPIPE to be ignored
<flux>
then you get a regular return code
<mrvn>
It should catch that and print something at least
<flux>
(and in ocaml that would be an exception)
<flux>
like it catches SIGINT, SIGTERM, SIGHUP.. no wait, it doesn't ;-)
<flux>
(it does have Sys.catch_break, though, but you need to enable it)
<flux>
what I've gathered about SIGPIPE is that it's a way have such programs die that don't pay attention
<flux>
that is, otherwise they might keep producing output infinitely
<flux>
because they are lazy about checking return values
<flux>
but if they do pay attention, they get to tell the OS about it and then they won't be bugged anymore ;-)
<flux>
essentially, for daemons one always disables SIGPIPE
yezariaely has joined #ocaml
<whitequark>
it's not really return values
<whitequark>
$ foo | bar
<yezariaely>
Is there an easy way to install opam on a 32 bit machine? The manual always talks about 64bit only?!
<mrvn>
Ok, setting the finaliser in initialiser doesn't keep the object alive.
<whitequark>
`bar' is not a child of `foo', they're both children of the shell
<flux>
whitequark, return values of system calls
<flux>
not return values of programs
<whitequark>
oh
<flux>
so let's say we have a pipeline like: grep 'Zab' < /dev/urandom | head -1
<mrvn>
then the return value of grep is lost
<flux>
if grep doesn't check the return value of each write(3) it does (so probably puts(1) of printf(1)), it will neatly terminate after the first row is found
<dsheets>
mrvn, hooray
<flux>
but if there was no such mechanism around and grep still didn't check the return value, it would keep running forever
zpe has joined #ocaml
<flux>
actually it won't terminate neatly after the first row is found, but after the second :)
<flux>
hmm, actually how does the pipeline get terminated usually, probably not by that mechanism..
<mrvn>
flux: you close each end
<mrvn>
writer first then the reader gets an EOF
<flux>
right, but if the first writer never writes EOF?
<flux>
but it appears it works just as I said
<flux>
it will die because of a write error
<flux>
not optimally immediately after getting that one row
<mrvn>
yes, writing to a pipe that is closed on the other end will fail
<flux>
I was sort of hoping there would be some pipeline termination magic after the last command is finished. but I suppose that would break too many things.
zpe has quit [Ping timeout: 245 seconds]
<mrvn>
flux: you mean something that kills the other process directly?
<flux>
yes. SIGHUP seems almost appropriate, for instance.
<flux>
but there doesn't appear to be anything like that.
<mrvn>
flux: I wonder if select will report the pipe as error pending
<flux>
it will at least be a pending read, possibly an exceptional state as well
<flux>
but I'll go think of these things in my bed, good night :)
<wmeyer>
orbitz: unfortunately I haven't seen any good applications handling Forestr's system
<wmeyer>
mrvn: nope
* wmeyer
is a bit grumpy today. You have been warned :-)
brendan has quit [*.net *.split]
Nahra_ has quit [*.net *.split]
so has quit [*.net *.split]
avsm has quit [*.net *.split]
jbrown has quit [*.net *.split]
milosn has quit [*.net *.split]
cross has quit [*.net *.split]
yroeht has quit [*.net *.split]
aggelos__ has quit [*.net *.split]
rks`_ has quit [*.net *.split]
Khady has quit [*.net *.split]
avsm_ is now known as avsm
<mrvn>
Lets do a 2h planning session on how to do a 5 minute job.
<wmeyer>
mrvn: no suprises, most of companies work like this
<mrvn>
Mark Forstrs auto-focus system: 1) use Mark Forstrs auto-focus system, ... nah, don't feel like doing that today.
<wmeyer>
mrvn: entirelly you choice :-)
<wmeyer>
I like auto-focus, it works for me
<mrvn>
I have a BTS for that
<mrvn>
including priorities, deadlines, dependencies and milestones
<wmeyer>
but it needs certain infrastructure, like none of the task managment apps for android is able to handle closed lists
<wmeyer>
that's bad, because Forestr explains first why we should not do it
<mrvn>
wmeyer: use vi
<wmeyer>
sorry, I could use org-mode, if so, but I have to be portable
<wmeyer>
and not feeling like taking notes in the notebook for that
<wmeyer>
BTS is fine, but it's not a force that tells you to do the tasks. It's good as a backlog and release planner
<wmeyer>
in contrast auto-focus just works, for many psychological reasons :-)
<wmeyer>
and I will stick into that now, once I am able to maintain my task lists in the mobile
<wmeyer>
but for that I think I have to write a small app
brendan has joined #ocaml
<wmeyer>
since I've not tried ocaml-android now I will have chance
clog has quit [^C]
clog has joined #ocaml
<ousado>
(node-webkit is chromium+nodejs)
<Drup>
huum, interesting
<ousado>
indeed
<ousado>
IMHO the best option for GUI applications
<ousado>
will support webRT soon
<Drup>
ousado: I'm trying to see if there is a formal description of the API, like jquery, we might be able to try to scrunch everything to produce ocaml's binding code
<ousado>
for node-webkit?
<Drup>
for phonegap
<wmeyer>
good night everybody!
<ousado>
wmeyer: good night!
<ousado>
Drup: I don't think so
<ousado>
but the API isn't big
<mfp>
ousado, Drup: btw., I actually got node-webkit + eliom working
<Drup>
mfp: oh !
<Drup>
mfp: we were talking about this a few days ago, could you give more details ?
<ousado>
mfp: nice :)
<mfp>
I'll try to put something up on github in the next few days
<ousado>
mfp: and would you recommend it?
<Drup>
ousado: you should never say a js api is small, there is almost always hidden complexity somewhere x)
<mfp>
it's quite trivial actually; 1st thing is getting eliom not to crash on init by initializing the vars it expects in the .html
<Drup>
mfp: did you had to modify a lot of things in eliom ?
<ousado>
Drup: parts of the APIs are based on web standards
pkrnj has quit [Quit: Computer has gone to sleep.]
<ousado>
those are big, but documented
<mfp>
I wanted to communicate with a daemon, so I wrapped a tiny bit of node API to talk via a socket
<mfp>
Drup: no changes in eliom whatsoever :)
<Drup>
wow, that's great
<mfp>
all the tyxml and DOM stuff works fine
<Drup>
mfp: do you use the server part of eliom ?
<ousado>
I can't say I'm surprised :)
<mfp>
Drup: nope, haven't even tried
<mfp>
of course, injecting server-side values and stuff would be involved
<mfp>
but using typed services should work
<Drup>
mfp: how do you load the page then ? You have to run an ocsigen server somewhere, don't you ?
<ousado>
the pages are usually part of a zip-file
<dsheets>
why is bigarray a separate lib distributed with ocaml? is it not portable?
<mfp>
Drup: atm. I have only 1 .html that loads the js with the compìled eliom code
eikke has joined #ocaml
<mfp>
Drup: all the other contents are generated dynamically by the program compiled with js_of_ocaml
<mfp>
i.e., just using the code you'd have on the server that does things like div ~a:[a_class ["whatever"]] [ pcdata "foo" ]
<mfp>
directly in the code compiled to .js
<Drup>
mfp: ok so you're only using the library part of eliom and use js_of_ocaml
<mfp>
right
<Drup>
it's definitly the right idea for what your doing indeed
<mfp>
no heavy magic with injected server-side values or whatever, just the eliom lib for generating the contents dynamically and type-safe manipulation of the DOM
<Drup>
(heavy magic is sometime useful :D)
<mfp>
well, in this case the heaviest magic is the server <-> client side of eliom
<Drup>
indeed
<mfp>
I just used a simple JSON-based protocol for message passing communication between a daemon and the GUI
<mfp>
using ATD to generate all the (de)serialization code, which can then be used in both the UI (compiled with js_of_ocaml) and the native daemon it talks to
<Drup>
mfp: I will talk about this to some other people but you should clearly publish it somewhere, It's very interesting
<Drup>
mfp: it's the clever kind of ugly, but it's still kind of ugly x)
<whitequark>
and I want .[] on strings to work
<mrvn>
module Array = struct let get x y = x + y end;;
<mrvn>
# let x = 1 in let y = 2 in x.(y);;
<mrvn>
- : int = 3
<whitequark>
yeah awesome
<mfp>
don't compile with -unsafe though ;)
<mfp>
no, actually that wouldn't matter
<mfp>
I think
<mrvn>
work for module String too
<mrvn>
mfp: -unsafe might use get_unsafe
<whitequark>
let get (str : string) pos =
<mfp>
unsafe_get
<whitequark>
List.nth (utf32_of_utf8s str) pos
<whitequark>
horrible isn't it
<whitequark>
but at least you couldn't realistically make it *less* efficient
<mrvn>
Is there something for graphics as simple as SDL without all those busy loops?
<mfp>
mrvn: right, but you can override it too and everything would work fine (tm) (for a sec I thought the compiler would inject a primitive %whatever directly)
<Drup>
mrvn: depends, what are you trying to do ? 2d, 3d, with widgets or drawing ?
<mrvn>
Drup: 2d, widgets I can do myself
<whitequark>
pippijn: hmm, your type utf16s = int list is wrong, I think
<Drup>
mrvn: I like cairo
<whitequark>
actually nevermind
<pippijn>
whitequark: why is it wrong?
<mrvn>
Drup: how is that simple?
<whitequark>
pippijn: I was wrong
<ousado>
mrvn: how about node-webkit :)
<pippijn>
ok
<pippijn>
what did you think?
<Drup>
mrvn: the ocaml API for drawing is not complicated
<mrvn>
ousado: and have everything run in a browser?
<whitequark>
pippijn: that it should be `utf16 list`
<ousado>
mrvn: node-webkit gives you a desktop-app
<whitequark>
but utf8s isn't `utf8 list` anyway
<pippijn>
ah
<ousado>
mrvn: but you can run the same code in a browser, yes
<pippijn>
right
<whitequark>
pippijn: we'd need to do a rather major refactor to squeeze any perf out of ucslib.
<whitequark>
will probably look horrible after that, too.
<pippijn>
whitequark: I'm going to rewrite it
* whitequark
nods
<pippijn>
everything will be string
<Drup>
mfp: you can probably drop the "{client{ }}" and don't use the eliom syntax extension
<whitequark>
I'll take care to publish my changes until that, then
<pippijn>
sure
<pippijn>
I was a little busy today, because aldor was released
<pippijn>
I have worked for that for 6 years :)
<pippijn>
so there was a lot of talking going on toda
<pippijn>
y
<mrvn>
Drup: and for mouse events?
<whitequark>
aldor ?
<mrvn>
ousado: do you have some example in ocaml for that?
<mfp>
ousado: I actually thought about that too; for instance you could wrap a toplevel compiled with js_of_ocaml + implement the Graphics API to get easily graph-enabled toplevels for all 3 systems at once (just a matter of packing the compiled js and assets with the platform-specific nw executable)
<mfp>
mrvn: it's V8, so the performance is OKish in many cases (reported as somewhat faster than ocaml bytecode)
<mrvn>
I'm pretty sure I will need the extra boost from ocamlopt.
<whitequark>
pippijn: yeah. that subset of dependent types is more or less equivalent to what C++ templates do
<whitequark>
do you do monomorphization?
eikke has quit [Ping timeout: 248 seconds]
walter has quit [Quit: This computer has gone to sleep]
<mfp>
mrvn: if it's just for representation (i.e., having message-passing between a native OCaml backend and the OCaml code (compiled to JS) running on node-webkit is not too onerous), you could use the approach I described above
<mrvn>
mfp: Its for a game with some serious computations in the background.
<mfp>
mrvn: if it's more "real-time" stuff, it won't do
<mfp>
but would communication between the UI and the engine be a bottleneck?
<Drup>
mrvn: are you sure you will have a performance problem with sdl ?
<whitequark>
if it's a game with serious computation, js is a wrong thing to use
<whitequark>
and likely ocaml too
<ousado>
lol
<Drup>
ocaml is perfectly fine with serious computation
<whitequark>
Drup: depends on how serious it is
<whitequark>
does it vectorize?
<Drup>
(not js, I agree)
<mrvn>
The game is turn based but the client will have to do look ahead of many turns for things. The game has a time lag effect so you make a decision and it will be enacted in your colony in X turns. The GUI has to be able to project the future of a colony quickly.
<whitequark>
oh, that shouldn't be a problem
<whitequark>
not very serious though :D
<Drup>
whitequark: you never did any IA for saying that this is not serious computation ~~
<mrvn>
Drup: sdl will work. I just don't like busy loops. It shouldn't waste cpu time when nothing is happening.
mcclurmc has quit [Ping timeout: 240 seconds]
<whitequark>
Drup: IA?
<Drup>
AI* (too much french)
<whitequark>
Drup: I didn't, right
<mrvn>
whitequark: you offlode the vectors to C functions that run on many cores and use the APU/GPUs.
<whitequark>
mrvn: see, that's not ocaml anymore. ocaml+c.
<mrvn>
whitequark: that's what makes it serious :)
<Drup>
mrvn: if you want to run calculation on GPUs, you can try spoc too
<whitequark>
mrvn: sure, you could be fine with such combo. but it comes with its own set of problems.
chrisdotcode_ has joined #ocaml
<mrvn>
whitequark: I did that for a fractal app. The inner loop for the fractals comes from C. All the high level stuff in ocaml.
<pippijn>
whitequark: no
<whitequark>
mrvn: it becomes problematic when you need to pass large data structures back and forth
chrisdotcode has quit [Ping timeout: 256 seconds]
<pippijn>
whitequark: except when part of inlining
<whitequark>
large/complex
<mrvn>
Drup: not for the game.
<mrvn>
whitequark: bigarray
<whitequark>
mrvn: >structures
<Drup>
mrvn: anyway, you still have the solution "openGL directly"
<Drup>
it's not really a good solution, though
<mrvn>
Drup: openGL without GL hardware is abysimal. I don't plan to have 3D so GL just reduces the number of systems I can run on.
<Drup>
do you really target systems without openGL and still want to run heavy computation ?
<whitequark>
mrvn: just about any system has GL these days
<whitequark>
show me an example of something which doesn't
<mrvn>
whitequark: theoretically. Having proper drivers for it is another matter.
<mrvn>
whitequark: pretty much every nvidia chipset
<whitequark>
hm
<Drup>
that's wrong, but I'm not gonna try to debate on this :)
<mrvn>
nvidia works with the non-free binary blobs. But if you want free drivers you get into problems.
pkrnj has quit [Quit: Computer has gone to sleep.]
<whitequark>
mrvn: for UI free drivers work just as well
<mrvn>
novoue just doesn't cut I jet imho
<mrvn>
Has anyone tried that QtQuick thing that was on the ML recently?
<pippijn>
whitequark: what is a piece of a utf called?
<pippijn>
whitequark: e.g. what is one half-word in utf16 called?
<pippijn>
a 16 bit number, what is that called?
<mrvn>
byte?
<pippijn>
hm
<mrvn>
char? codepoint= glyph?
<pippijn>
not codepoint
<pippijn>
codepoint can be 1 or 2 utf-16 "things"
<whitequark>
pippijn: one sec
osnr has joined #ocaml
osnr has quit [Changing host]
osnr has joined #ocaml
<whitequark>
"code unit"
<whitequark>
byte < code unit < code point = character < grapheme
<whitequark>
or should I say "octet" :D
Simn has quit [Quit: Leaving]
Nahra has quit [Quit: leaving]
Nahra has joined #ocaml
<pippijn>
whitequark: is an utf8 byte also a code unit?
paolooo has quit [Quit: Page closed]
<whitequark>
pippijn: yes
<pippijn>
good
eikke has joined #ocaml
osnr has quit [Remote host closed the connection]
Neros has joined #ocaml
<pippijn>
whitequark: I'm designing an UTF interface