madroach has quit [Read error: Connection reset by peer]
tennix has joined #ocaml
yegods has quit [Read error: Connection reset by peer]
jeffmo has quit [Ping timeout: 240 seconds]
sh0t has quit [Ping timeout: 244 seconds]
pyon has quit [Quit: ... flowering silent scarlet piece of night.]
yegods has joined #ocaml
pyon has joined #ocaml
FreeBirdLjj has joined #ocaml
sh0t has joined #ocaml
<Bluddy[m]>
To those knowledgeable in such things: is there a reason typing/ident.ml doesn't use a Map.t?
FreeBirdLjj has quit [Ping timeout: 272 seconds]
<gasche>
Bluddy[m]: this code was written before Map existed
<Bluddy[m]>
gasche: Can I submit an update?
<gasche>
(I think there is no deep reason other than "if it ain't broke, don't fix it")
<Bluddy[m]>
It's messy code though
<gasche>
hm
<gasche>
is it?
<Bluddy[m]>
just look at it
<Bluddy[m]>
it's got all the guts of Map right in there
<gasche>
I think you would have to check that using Map doesn't degrade performances
<gasche>
(because the function application may not be inlined, and this code may be really hot in the type-checker)
<Bluddy[m]>
I can do that
<gasche>
if the performance is as good, I can't judge whether other people would like the change, but I think you have a case
<gasche>
I don't find the code particularly messy, though
<Bluddy[m]>
really?
<Drup>
Bluddy[m]: it's not exactly a map
<Drup>
it has buckets and the find function is different
tennix has quit [Ping timeout: 258 seconds]
<Drup>
since flambda, there is also an Ident.Map, and it doesn't have the same semantics as Ident.tbl
<gasche>
hm
<gasche>
yeah, old bindings are pushed
<Drup>
yeah
<Drup>
(that's pretty important for my eliom fork, actually)
<gasche>
but you would use a (ident list map)
<gasche>
maybe that's what Ident.Map does
<Drup>
gasche: that's going to be slower
<gasche>
good point
<Drup>
(and no, Ident.Map is just Map.Make(Ident)
<Drup>
(with stamp equality)
<Drup>
after playing with that part of the compiler for a significant amount of time, I don't think you should replace it with a normal map. The code could be improved a bit though.
<gasche>
hm
<Drup>
some functions are manually inlined and stuff like that, we don't need that anymore.
<Bluddy[m]>
Drup (IRC): couldn't you make a map with just the {data; previous} part as the value?
<Drup>
Bluddy[m]: you need to redefine the find function anyway
<Drup>
what do you gain ?
<gasche>
chenglou: "local syntax" sounds a lot like what camlp4 was doing
<gasche>
interesting that you also felt this need
<Bluddy[m]>
Drup (IRC): if you do need to redefine it, you gain nothing, because the type is opaque
<Bluddy[m]>
If you can use the map interface, you get reduced complexity
<gasche>
Bluddy[m]: you best bet may be to write a comment that explains the difference between this map-looking code and Map
<gasche>
and move on
<Drup>
maybe you can implement find on top of Map.find, not completely sure, but you need to be careful about performances
<Drup>
(Ident.tbl is the most central datastructure of the typechecker, it's used literally everywhere)
<Bluddy[m]>
fair enough
<Bluddy[m]>
I had to ask :)
<Drup>
it's good to ask, and a comment there would be nice
<Drup>
(that reminds me that I have a patch to remove the duplication of map modules)
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
Algebr` has joined #ocaml
yegods has quit [Ping timeout: 264 seconds]
tmtwd has joined #ocaml
yegods has joined #ocaml
ygrek has quit [Ping timeout: 244 seconds]
seangrove has quit [Ping timeout: 250 seconds]
nua has joined #ocaml
nua has quit [Client Quit]
A19774941 has joined #ocaml
A1977494 has quit [Ping timeout: 272 seconds]
sh0t has quit [Remote host closed the connection]
tmtwd has quit [Ping timeout: 240 seconds]
pierpa has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
tmtwd has joined #ocaml
yegods has quit [Remote host closed the connection]
<Algebr`>
C is so odd, seeing a message in emacs when hovering over void: Builtin typeless type: void Sounds odd to say outloud
johnelse has quit [Ping timeout: 240 seconds]
johnelse has joined #ocaml
kushal has joined #ocaml
shinnya has quit [Ping timeout: 276 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
AlexDenisov has joined #ocaml
yegods has joined #ocaml
jonasen has joined #ocaml
yegods has quit [Ping timeout: 264 seconds]
tennix has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
FreeBirdLjj has joined #ocaml
nivek has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
tmtwd has quit [Ping timeout: 246 seconds]
yegods has joined #ocaml
yegods has quit [Ping timeout: 276 seconds]
nivek has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FreeBirdLjj has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
copy` has quit [Quit: Connection closed for inactivity]
dwillems has joined #ocaml
dwillems has quit [Quit: Ex-Chat]
rgrinberg has quit [Ping timeout: 250 seconds]
butts_butts has joined #ocaml
tane has joined #ocaml
A1977494 has joined #ocaml
A19774941 has quit [Ping timeout: 240 seconds]
freusque has joined #ocaml
A1977494 has quit [Quit: Leaving.]
A1977494 has joined #ocaml
dexterph has joined #ocaml
nojb_ has joined #ocaml
AlexDenisov has joined #ocaml
butts_butts has quit [Ping timeout: 252 seconds]
bruce_r has quit [Ping timeout: 250 seconds]
Simn has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
AltGr has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
bugabinga has joined #ocaml
mcls has joined #ocaml
AlexRussia has quit [Ping timeout: 258 seconds]
bugabinga has left #ocaml [#ocaml]
tane has quit [Ping timeout: 258 seconds]
Algebr` has quit [Remote host closed the connection]
dwillems has joined #ocaml
<def`>
Bluddy[m], gasche, companion_cube: I don't have the context, but I saw in my log you talked about implicit work
<def`>
development is paused, will resume after ICFP :)
tane has joined #ocaml
mcls has quit [Quit: leaving]
AlexDenisov has quit [Read error: Connection reset by peer]
AlexDenisov has joined #ocaml
dave24 has joined #ocaml
rossberg_ has quit [Ping timeout: 264 seconds]
yegods has joined #ocaml
rossberg_ has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
TheLemonMan has joined #ocaml
MercurialAlchemi has joined #ocaml
yegods has quit [Remote host closed the connection]
<Leonidas>
Algebr: yes, weird types with no inhabitants :(
tane has quit [Quit: Leaving]
dhil has joined #ocaml
yomimono has joined #ocaml
AlexRussia has joined #ocaml
<haesbaert>
merlin had support for cstruct syntax extensions at some point, no ?
malc_ has joined #ocaml
tane has joined #ocaml
yegods has joined #ocaml
malc_ has left #ocaml ["ERC (IRC client for Emacs 25.0.50.2)"]
silver has joined #ocaml
jwatzman|work has joined #ocaml
yegods has quit [Ping timeout: 244 seconds]
redpoppies has joined #ocaml
yegods has joined #ocaml
<tormen>
hmm. What is the easiest way to flatten a list of list of strings to a string ?
<tormen>
hmm. What is the easiest way to flatten a list of lists of strings to a string ?
dwillems has quit [Ping timeout: 240 seconds]
<tormen>
ah right I think one can transform a list of lists of x to list of x and then use String.concat on this, right ?
<tormen>
;)
<pippijn>
yes
<tormen>
:)
<pippijn>
that's one way
<tormen>
;)
<tormen>
are flatten and concat identical ?
<pippijn>
the resulting string won't have the sublists in it printed as lists
<pippijn>
yes
<pippijn>
tormen: the docs of flatten say "Same as concat"
<tormen>
pippijn: hmm. but it is confusing that they don't show the same description...
<tormen>
pippijn: why repeat " Not tail-recursive (length of the argument + length of the longest sub-list)." ? With ONLY "Same as concat" things would be clearer :)
<tormen>
... this + the fact that usually ocaml seems to try to be rather MINIMAL in terms of fns in the standard library made me wonder...
<tormen>
;)
<tormen>
pippijn: thanks anyways !!
<pippijn>
it probably got renamed and the old name was retained
<tormen>
what is the best way to recommend only stating "Same as concat" ?
<tormen>
pippijn: mantis ?
<pippijn>
probably yes
<tormen>
ok, will do :)
yegods has quit [Remote host closed the connection]
lostman has quit [Quit: Connection closed for inactivity]
dwillems has joined #ocaml
yegods has quit [Read error: Connection reset by peer]
yegods has joined #ocaml
sdothum has joined #ocaml
<Bluddy[m]>
def` (IRC): I understand the hiatus, but are you working on the theoretical side, implementation side, or both?
chinglish has joined #ocaml
octachron has joined #ocaml
<Bluddy[m]>
I'm going through cmmgen.ml. In line 1429 (branch 4.03) in function transl, anybody know why we automatically box variables (under the Uvar id pattern match)?
nivek has joined #ocaml
<def`>
Bluddy[m]: by default things are box, then a unboxing pass is ran
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
tennix has quit [Ping timeout: 246 seconds]
yegods has quit [Read error: Connection reset by peer]
yegods has joined #ocaml
ggole has joined #ocaml
yegods_ has joined #ocaml
yegods has quit [Read error: Connection reset by peer]
agarwal1975 has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
<tormen>
How can I avoid that "\" is used as escape character in a string "foo \ bar" ?
<tormen>
.... ah I guess that depends on the function that gets the string ;)
<tormen>
... ok print_endline seems to do that ... how about printf ?
<tormen>
... ok I'll try ;) ... sorry for the noise
<mehdib>
it does not depend of the function
<tormen>
mehdib: ah okey. then my initial question stands :)
<companion_cube>
if you want to output a \, then it's \\
<companion_cube>
self-escaping
<tormen>
companion_cube: yes, but can I avoid having to replace all my \ with \\ if I have literal strings, that I want to be "as-is" ??
<ggole>
You can use {||} strings
<companion_cube>
well, with "" you can't ; with {||} you can
yegods_ has quit [Read error: Connection reset by peer]
* tormen
hates the fact that google does not index by special characters :/
<tormen>
ggole: thanks :))
Denommus has joined #ocaml
<tormen>
ggole: next time I'll check on the ext.hml first myself :))
<tormen>
Cool. That's exactly what I needed :)
<tormen>
... funny idea with the optional "id" ... hehe. nice
<seliopou>
\this may be a stupid question, but is there a way to fake a polymorphic exception without magic?
<Drup>
polymorphic exception ?
<seliopou>
e.g., exception Fail of 'a t
<Drup>
exception Fail : 'a t -> exn
<mrvn>
seliopou: and how would you ever use that?
<Drup>
you can have GADT exceptions
<seliopou>
Drup o rly?
<mrvn>
or { 'a . { 'a -> string; 'a; }}
<Drup>
seliopou: magic, isn't it ?
<tormen>
Mince. It seems one cannot assign a {||} string to a value ? ... ocaml v4.02.3 complains :(
<Drup>
tormen: which code did you try ?
<tormen>
(e.g. let foo = {|bar|} ;;)
FreeBirdLjj has quit [Ping timeout: 252 seconds]
<tormen>
--> gives me: Parse error: [expr] expected after "=" (in [cvalue_binding])
<Drup>
You are using camlp4
<tormen>
so a string-literal does not count as expr ?
<tormen>
Drup: hmm. I am using pgocaml with uses it, yes.
<Drup>
It's just a case of camlp4 not supporting some recent ocaml syntax
yegods has joined #ocaml
<tormen>
Drup: ah I see. Ok then I'll wait :))
barkmadley[m] has quit [Ping timeout: 240 seconds]
<tormen>
Drup: t-h-a-n-k-s :)))
M-jimt has quit [Ping timeout: 246 seconds]
M-Illandan has quit [Ping timeout: 264 seconds]
Kakadu2[m] has quit [Ping timeout: 244 seconds]
regnat[m] has quit [Ping timeout: 246 seconds]
M-martinklepsch has quit [Ping timeout: 264 seconds]
MercurialAlchemi has quit [Ping timeout: 276 seconds]
<tormen>
Drup: so does my vim syntax highlighting (NOT yet recognizing it as a string ;))
M-ErkkiSeppl has quit [Ping timeout: 260 seconds]
Bluddy[m] has quit [Ping timeout: 272 seconds]
M-pesterhazy has quit [Ping timeout: 272 seconds]
tennix has joined #ocaml
A1977494 has quit [Quit: Leaving.]
Bluddy[m] has joined #ocaml
<Bluddy[m]>
def`_ (IRC): care to direct me to that unboxing pass? Seems like there's some unboxing going on in the general translate function, which is why it's strange that accessing an unboxed variable automatically boxes it.
<Bluddy[m]>
Also, boxing can take many forms, so it's hard to undo in the AST.
chinglish has quit [Ping timeout: 276 seconds]
sh0t has joined #ocaml
redpoppies has quit [Read error: Connection reset by peer]
redpoppies has joined #ocaml
<gasche>
Bluddy[m]: one nice way to learn about a piece of the OCaml codebase is to look for pull requests touching it
<gasche>
it they're still open, you can double with a review, asking questions/clarifications on stuff that's hard to understand, etc.
<gasche>
(but it doesn't give much on the flambda part)
redpoppies has quit [Ping timeout: 246 seconds]
rgrinberg has joined #ocaml
aphprentice has joined #ocaml
rgrinberg has quit [Client Quit]
rgrinberg has joined #ocaml
Oxford is now known as foot-criminal
Denommus` has joined #ocaml
<Bluddy[m]>
gasche (IRC): I don't actually find large PRs like that to be very helpful. Part of the problem is that there's a lot of 'oral tradition' in the code that isn't documented. FLambda is the exception -- I think it's very well documented, but I'm first going over the last stages of the backend (I started out with the typechecker but that took way too long).
Denommus has quit [Ping timeout: 264 seconds]
<Drup>
Bluddy[m]: what's your goal ?
<Bluddy[m]>
Drup (IRC): To understand, and then to come up with improvements.
<Drup>
which parts ? what do you want to improve ?
redpoppies has joined #ocaml
<Drup>
the compiler is to big (and confusing/complicated) to just say you are going to swim in it until you get enlightenment :p
<gasche>
my own technique is to review the changes that people propose, and get pieces of understanding that way
foot-criminal is now known as Oxford
Kakadu2[m] has joined #ocaml
<gasche>
reviewing also has the advantage that if you have a question, you just ask it and people answer it
<gasche>
(they don't yet have the self-discipline to add a clarifying comment at that point, but that will come with habit)
<Drup>
my advise is to determine a task that you are interested in (hopefully not something to big) and dive in. That task can totally be, as gasche poitned out "help review/code this feature/PR".
<Bluddy[m]>
Well one task is just to clarify the code with comments/refactor it. That in itself will help me, and it'll help anyone coming along after me.
<Bluddy[m]>
And gasche (IRC), I do understand the merits of your approach and I'll try to adopt it.
<gasche>
I'm not saying everyone must it this way
<gasche>
did you send your Ident/map clarifying comment ? :p
<Bluddy[m]>
No, I'll do it when I get a chance.
<Bluddy[m]>
I only ventured into Ident because of going through cmmgen
<Bluddy[m]>
and my question was about transl in cmmgen, because there's a whole bunch of code that handles unboxing, and for some reason as soon as we encounter a Uvar id we decide to box it, which isn't easily undoable.
Denommus` is now known as Denommus
yegods has quit [Ping timeout: 240 seconds]
yegods has joined #ocaml
<Bluddy[m]>
ok I got it. It's pretty ugly though. I kinda feel like we should have a version of cmm with boxing and unboxing as part of the AST, to cancel it out cleanly.
wiredsister has joined #ocaml
regnat[m] has joined #ocaml
M-martinklepsch has joined #ocaml
M-jimt has joined #ocaml
M-ErkkiSeppl has joined #ocaml
barkmadley[m] has joined #ocaml
M-pesterhazy has joined #ocaml
M-Illandan has joined #ocaml
<tormen>
hmmm. Any particular reason why "" need to be /balanced/ within an ocaml comment ?
<tormen>
(e.g. (* "bla *) won't compile)
<tormen>
... maybe again camlp4 ?
<nojb_>
this is necessary to allow to comment code out reliably (imagine commenting code containing strings containing (* *))
<tormen>
nojb_: hmm. Not a parsing expert, so I believe you :) ... but then the compiler error message about an unterminated comment should be enhanced, because it's an unterminated string within a comment ;)
<tormen>
gasche: I'll send you a mail ^^
<tormen>
nojb_: thanks!
MercurialAlchemi has joined #ocaml
nivek has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yegods has quit []
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 246 seconds]
Sorella has joined #ocaml
cat5e has quit [Ping timeout: 246 seconds]
cat5e has joined #ocaml
pyon has quit [Ping timeout: 246 seconds]
A1977494 has joined #ocaml
<tormen>
gasche: mail sent, subject "#ocaml part 2"
<tormen>
... I added some bonus stuff ;)
<tormen>
... let me know if you find that useful and I'll keep going ;)
hcarty has joined #ocaml
<_y>
does someone know of a reference somewhere on the www to witness that Str is generally regarded as being deprecated?
<_y>
can be mostly anything, from a blog post to a mention in a Github PR’s or Mantis ticket’s comment
<companion_cube>
gasche: none, it's for model finding
newcomer has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
octachron has quit [Quit: Page closed]
<hcarty>
companion_cube: Parsing msgpack
<companion_cube>
gasche: it's intended as a competitor to (lazy)smallcheck and the likes
Denommus` has joined #ocaml
<Bluddy[m]>
hcarty: you're parsing msgpack using what library?
<hcarty>
Bluddy[m]: angstrom
Denommus has quit [Ping timeout: 264 seconds]
<Bluddy[m]>
?
<Bluddy[m]>
msgpack is very low level
<Bluddy[m]>
you're unlikely to get great performance this way
<Bluddy[m]>
I mean maybe I'm wrong
<companion_cube>
I wonder, how much slower than a handwritten parser do you get, hcarty?
dwillems has quit [Ping timeout: 252 seconds]
<Bluddy[m]>
btw the ocaml-msgpack library is not well implemented as far as I could tell
<hcarty>
Bluddy[m]: It's extacted from Coq code and, unfortunately, comes with each byte parsed as an 8-element bool tuple
<hcarty>
*extracted
jwatzman|work has quit [Quit: jwatzman|work]
<Bluddy[m]>
yes what I meant to say is that it's absolutely horrible :)
<hcarty>
companion_cube: Not sure - I started this as an experiment because (a) ocaml-msgpack is very slow for large messages and (b) learn a bit of angstrom
<hcarty>
I'd never used a parser combinator library before
mmorga has joined #ocaml
<Bluddy[m]>
well, looking at angstrom's json implementation, it seems low-level enough and should perform well, so maybe this could work
<hcarty>
Bluddy[m]: The msgpack-angstrom implementation is already reasonably performant... depends on the data you're processing
<Bluddy[m]>
seliopou: how do you do 0-copy I/O?
<Bluddy[m]>
hcarty: how so? Do you have the repo up?
<Bluddy[m]>
so the idea of angstrom is that you create the low-level parser, and then use high-level combinators over it?
pierpa has joined #ocaml
agarwal1975 has quit [Ping timeout: 260 seconds]
Denommus` is now known as Denommus
<seliopou>
Bluddy[m]: yeah the goal is to expose performant parsers and then allow users to build more complex ones on top fo them
dxtr has quit [Ping timeout: 276 seconds]
<seliopou>
so for example take_while, skip_while, etc, are implemented as a for loop with no backtracking.
<seliopou>
wrt zero-copy io, it's zero-copy with respect to your input channel
<mrvn>
Bluddy[m]: 0-copy I/O only works with bigarray
<seliopou>
that too :D
<seliopou>
i really should get rid of the string/bigarray dispatch
<seliopou>
force an additional copy if you wanna deal with string inputs?
<mrvn>
stdlib should have bigarray channels
<seliopou>
reasonable?
<mrvn>
seliopou: string input already copied once
<Bluddy[m]>
the thing about angstrom that I can see is, it needs to have some way to use integers for int32 and int64 values. Boxing could kill performance. So on 64 bit platforms, it should use ints for 32 bits, and maybe have a lossy 64 bit value that uses ints. On 32 bit platforms, it may even be worthwhile to save 32 bits into a pair of ints.
newcomer has quit [Ping timeout: 264 seconds]
dxtr has joined #ocaml
<mrvn>
Bluddy[m]: it's not so much an overhead as you think and a lot gets optimized away nowadays
newcomer has joined #ocaml
<seliopou>
Bluddy[m]: before hcarty's pr (which was great), it did not deal with ints at all, now it relies on ocp-endian for dealing with such things
<Bluddy[m]>
mrvn: Maybe. I just posted a simple example into mantis that doesn't unbox. Any function call will cause boxing.
<mrvn>
Bluddy[m]: function call should inline
<Bluddy[m]>
mrvn: only if flambda decides it should. Doesn't work for recursive functions, for example.
<mrvn>
Bluddy[m]: true. but the recursion should be a goto and not box. So the one initial box/unbox becomes irelevant
nivek has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<mrvn>
Bluddy[m]: flambda could call the function unboxed though. worth reporting
<Bluddy[m]>
mrvn: the unboxing decisions are currently very localized and weak. They need to move into flambda to be good -- it needs to be a cost-based model.
<mrvn>
dmiller: it's nothing like segmentation
<mrvn>
ups, ewin
<Bluddy[m]>
mrvn (IRC): it's a boxing on every loop iteration.
<mrvn>
Bluddy[m]: that could be better
<Bluddy[m]>
all i'm saying is, don't assume
<mrvn>
optimizing tail calls would have been the first thing I optimize with unboxing.
<Bluddy[m]>
mrvn (IRC): all the unboxing code is currently in cmmgen.ml. It only looks ahead to the next symbol to decide if it should unbox. This is why results will be hugely suboptimal.
<mrvn>
anyway, for json you would read an int64 and store it in a record, constructor or bigarray. That should unbox.
<Bluddy[m]>
mrvn (IRC): hopefully, but I'd look at the cmm output just in case
<Bluddy[m]>
mrvn (IRC): especially when using combinators
jonasen has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Bluddy[m]>
try this: let _ = let f = 100. in let rec loop x = if x <= 0 then 0. else loop (x -. 5.) in loop f
newcomer has quit [Ping timeout: 264 seconds]
newcomer has joined #ocaml
nivek has joined #ocaml
<Bluddy[m]>
seliopou: i understand that buffer isn't called that often, but what drove you to use a class for this?
sh0t has quit [Ping timeout: 264 seconds]
newcomer has quit [Ping timeout: 276 seconds]
wiredsister has quit [Ping timeout: 276 seconds]
nivek has quit [Read error: Connection reset by peer]
nojb_ has quit [Ping timeout: 244 seconds]
yegods has joined #ocaml
yomimono has quit [Ping timeout: 258 seconds]
<ggole>
Unboxing the arguments of recursive functions can be a bit delicate because you need two entry points: one for the standard value format and one for unboxed values
<mrvn>
ggole: you have the entry point, that unboxes and flows into the unboxed function. All you (compiler) need to do is record boxed and unboxed address for every function.
nojb_ has joined #ocaml
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<ggole>
That's the obvious approach, but I don't believe OCaml does that.
copy` has joined #ocaml
<Bluddy[m]>
I don't think there's a concept of an inlined recursive function, which would allow for unboxing here. Currently, every function call causes boxing AFAIK, and the only thing that inhibits this is inlining.
<ggole>
flambda might unbox arguments of nonescaping nested functions - at least, I seem to recall something along those lines
<Bluddy[m]>
There's talk (and rightly so) of moving unboxing to flambda's domain, but the code isn't there yet
octachron has joined #ocaml
<ggole>
It's a bit irritating that recursive functions aren't inlined
<mrvn>
more than a bit
<ggole>
You have to detect the cycle and copy the whole thing rather than do a step of unfolding, but that isn't really very hard.
<ggole>
Doesn't GHC have the same problem?
<mrvn>
ggole: I imagine you would build a call graph. Then when you find a subgraph that is a) smaller than the function call overhead or b) only has < limit entries you inline.
<mrvn>
ggole: the recursion would remain inside the subgraph so shouldn't matter at all.
<ggole>
That's what I mean by detecting the cycle, yeah
AlexDenisov has joined #ocaml
<ggole>
Actually, I think having such a cycle "inside" the recursive function allows for the interior entry point needed for unboxing
<Bluddy[m]>
BTW one thing to consider is that the more inlining is done, the fewer GC safe points there are, so there's a performance impact there as well.
<mrvn>
ggole: the unboxed entry point and the recusive entry point is nearly the same. But the recursive entry of a tail call would not allocate a stack frame.
<mrvn>
ggole: you should have: entry, unboxed entry, tail entry
<mrvn>
Now the harder part is how to do unboxed return
<ggole>
I don't see why a tail call would need its own entry point
<mrvn>
Do you use: boxed entry; unbox; call unboxed_entry; box; return; unboxed_entry: ?
<mrvn>
ggole: doesn't allocate a stack frame
<ggole>
Why would it need to?
<mrvn>
ggole: it doesn't. that's the point. the unboxed entry needs to create a stack frame (if needed)
dhil has quit [Ping timeout: 276 seconds]
<ggole>
I still don't see the difficulty
<mrvn>
it isn't difficult. It's just a thrid entry point.
<mrvn>
or just a goto in the code if you transform tail calls before inlining.
<mrvn>
it's the same as a for or while loop
<Bluddy[m]>
mrvn (IRC): isn't a tail-call a property of the function? If so, it either has a tail-call entry or a normal entry, but not both
<ggole>
There's no difference between a tail-call entry and a normal entry
<mrvn>
Bluddy[m]: no, it's a property of the call
<ggole>
You can tail call any function. There's no need for a special entry point.
<mrvn>
Bluddy[m]: let foo x y = bla x y is a tail call.
<mrvn>
ggole: but there is a benefit from it for tail recursion
<mrvn>
you can avoid the stack frame and even allocation of temp variables if you see they never escape.
<ggole>
Oh, you just mean avoiding tearing down and immediately setting back up the stack frame
<mrvn>
ggole: yes
<ggole>
I wouldn't call that an entry point, but now I see what you're getting at
<mrvn>
I should test flambda with a mandelbrot fractal. ocaml used to be exceedingly bad at the inner loop.
<mrvn>
and then compare recursive with while and for loop
malc_ has joined #ocaml
AltGr has left #ocaml [#ocaml]
sh0t has joined #ocaml
yunxing_ has joined #ocaml
<hcarty>
Bluddy[m]: No repo yet - need to get a bit more polish in place, put it through an internal review and write the whole thing up. The current plan is an early August release.
chinglish2 has joined #ocaml
chinglish has quit [Ping timeout: 272 seconds]
<Bluddy[m]>
hcarty (IRC): I've already found some version of it using the power of google. Looks good so far.
<Bluddy[m]>
I would really not be surprised though if boxing kills angstrom's performance. And it's not angstrom's fault -- ocplib-endian already does it.
<hcarty>
I would like to do some testing against other language implementations of msgpack to see how speed compares. Haven't had time yet though.
<hcarty>
Bluddy[m]: Yeah, I've put up a gist or two which shouldn't be terribly out of date. That's just the inner workings though - there's a (hopefully) more user-friendly layer available as well
chinglish2 has quit [Quit: Nettalk6 - www.ntalk.de]
tane has quit [Quit: Leaving]
<ggole>
You know what would be handy? A way to say "ignoring any constructor field of this type in this match statement is a mistake".
<Bluddy[m]>
ggole: you mean other than upgrading the warning to an error globally?
<ggole>
Hmm, I guess I wasn't very clear.
<ggole>
I mean that if you have something like type t = Foo of x * x * int | Bar of x, then match zonk with Foo (a, _, _) -> ... | Bar of a -> ... would produce a warning
<ggole>
Not by default, but given an annotation or something on the match
ygrek has quit [Ping timeout: 246 seconds]
<Bluddy[m]>
I see
<Bluddy[m]>
The problem is that if you do it at the match site, you're already at the match site. So if you got one thing wrong, who's to say you didn't get the other thing wrong too?
<Bluddy[m]>
Makes more sense to annotate the constructor field (if that's possible) such that you can't use _ on it
<ggole>
The idea is that if you change the datatype to introduce some instances of x, you can't forget to handle it
<ggole>
But other stuff can still be ignored
<Bluddy[m]>
It's worth remembering that _ is always dangerous. Might be worth having a general warning (or at least a lint heuristic) for not matching on a field at all. You'd annotate to get rid of the warning.
kushal has quit [Quit: Leaving]
<ggole>
Naming everything is far to tedious
<ggole>
And makes unused variable warnings less useful.
<ggole>
I don't think that not matching on a field warrants a warning, since fields are often present but irrelevant.
<octachron>
ggole, you can use a "_" prefix (e.g. _name) to avoid the unused variable warning
<Bluddy[m]>
really? didn't know that!
<hcarty>
Bluddy[m]: ocamllint could probably be extended to support that if it doesn't already
<ggole>
I know, but that isn't really any different to using _
<Bluddy[m]>
yeah I don't see an easy solution here. You want to create invariants for the compiler to enforce, but those can be just as annoying.
<ggole>
I think a per-match annotation would serve quite well here
<ggole>
Whether it is worth the trouble is another question...
ncthom91 has joined #ocaml
<Bluddy[m]>
What I want is a warning when using (=) in any context other than primitives -- one I can override with an annotation
ncthom91 has quit [Client Quit]
<mrvn>
Bluddy[m]: i often ignore a field
<mrvn>
Bluddy[m]: think match (a, b) with (Int, _) -> print_int b | (Float, _) -> print_float b
<ggole>
You could let (=) = 0 and then have explicit bindings for primitive equalities
<ggole>
Seems a bit heavy handed to me
<Bluddy[m]>
Yeah I don't want to kill usability. I just want to be aware of the uses.
<flux>
people maybe should use records more than just tuples if names are of any interest :)
<mrvn>
flux: with GADTs you often match tuples.
<ggole>
Records are nice, but my concern was updating a datatype and forgetting to handle some field
<ggole>
(Or new constructor.)
butts_butts has joined #ocaml
sh0t has quit [Ping timeout: 250 seconds]
ygrek has joined #ocaml
sh0t has joined #ocaml
<ggole>
Oh, hmm. Type variables could get in the way a bit there.
jeffmo has joined #ocaml
ygrek_ has joined #ocaml
ygrek has quit [Ping timeout: 240 seconds]
yunxing_ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
butts_butts_ has joined #ocaml
yunxing_ has quit [Ping timeout: 250 seconds]
butts_butts has quit [Ping timeout: 240 seconds]
newcomer has joined #ocaml
seangrove has joined #ocaml
hcarty1 has joined #ocaml
hcarty has quit [Ping timeout: 250 seconds]
chris2 has quit [Ping timeout: 258 seconds]
TheLemonMan has joined #ocaml
ggole has quit []
shinnya has quit [Ping timeout: 252 seconds]
chris2 has joined #ocaml
slash^ has quit [Read error: Connection reset by peer]
redpoppies has quit [Quit: redpoppies]
yunxing_ has joined #ocaml
Kakadu has joined #ocaml
yegods has quit []
malc_ has quit [Quit: ERC (IRC client for Emacs 25.0.50.2)]
newcomer has quit [Ping timeout: 276 seconds]
Mercuria1Alchemi has joined #ocaml
AlexDenisov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Kakadu>
Folks, let's say that you have two functions f and g
<Kakadu>
and initial state
<Kakadu>
and you want to return f@@g state when `g state` finishes faster (than `f state`), and `g@@f state` when `f state` finsihes faster
<Kakadu>
The only thing that comes to my mind is threads
Denommus has joined #ocaml
<Kakadu>
but I didn't get how to cancel thread t with _all_ threads spawned by thread t
<adrien>
how do you define "faster"?
<Kakadu>
before
Mercuria1Alchemi has quit [Ping timeout: 260 seconds]
<Kakadu>
more concretely: doesn't go to eternal recursion
<adrien>
how do you measure before?
<adrien>
infinite recursion and "before" doesn't mean much
<adrien>
and what if both recurse infinitely?
<Kakadu>
if both than we should hang too. So, let's suppose that one of them will give some answer
blj has joined #ocaml
<Kakadu>
There original problem was that for some start input `s` expression `f @@ g s` fives an answer. But for another input it doesn't but `g@@f s` does.
<Kakadu>
So I want to execute `f s` and `g s` concurrrently and who will first give the answer will be `good guy`
<gasche>
octachron: very nice HTML rendering
<gasche>
kakadu: I think you can do that with sub-processes and signals, but it's kind of ugly
A1977494 has quit [Quit: Leaving.]
<gasche>
otherwise you could probably write both functions in a scheduling monad and use the combinators there
<gasche>
(eg. Lwt or Async)
<Bluddy[m]>
octachron: +1. I get weird rendering issues on chrome though
<Bluddy[m]>
gasche (IRC): I believe kakadu (IRC) would need to make f and g monadic for this to work, right?
<gasche>
yes, the functions have to be written using the monad
<gasche>
either you use the OS preemptive scheduling (solutions using processes or threads) or you use cooperative scheduling
<Kakadu>
Good moment to dive into Lwt!
<octachron>
Bluddy[m], ah yes, I forgot to test the css with chrome
mmorga has quit [Ping timeout: 250 seconds]
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
manizzle has quit [Ping timeout: 240 seconds]
orbifx has joined #ocaml
<orbifx>
hey all
<orbifx>
is there a prevalent library for developing web front ends?
<orbifx>
like the "Ruby on rails" of OCaml??
<orbifx>
Camels on rails :P
<bitbckt>
ocsigen?
<Kakadu>
Folks were going to do some RoR like extensible architecture based on Ocsigen but I don't know results
<Kakadu>
It's kind of big project to finish it in free time without concrete motivation
<gasche>
my understanding is that webmachine is not really for frontend web, rather to define lower-level services
<Bluddy[m]>
gasche: I asked this before but I think you missed my question. Any thought of merging effects before multicore? Would be good to have runtime callback support so we don't need monads for concurrency.
<gasche>
well
<gasche>
effects rely on runtime support that was introduced for multicore
<Bluddy[m]>
true, but multicore will probably take much longer, while effects should be easier to merge
<gasche>
I think that could be done, yes
blj has quit [Quit: Page closed]
<seangrove>
Is multicore on the 4.04 tick?
<seangrove>
flambda was the motivation to skip out on MC for 4.03 I think (multiple things in one tick that could cause segfaults, etc.)
<gasche>
not really
<gasche>
flambda was more-on-less-ready on 4.03 time, multicore was not (and still is not, to my knowledge)
<seangrove>
Bummer. I actually want to play with effects more than MC, but the two do seem very intertwined
butts_butts_ has quit [Ping timeout: 272 seconds]
Denommus has quit [Read error: Connection reset by peer]
<gasche>
I think it's too early to ask the people working multicore specific integration strategies
<gasche>
on the other hand, KC's blog post on reagents highlights ways to help the project
<edwin>
this is a nice way to describe type system enhancements
<octachron>
gasche, in a half-related way, do you think it would be too cumbersome to have number/name/id for compiler errors?
sepp2k has quit [Quit: Leaving.]
Simn has quit [Quit: Leaving]
silver has quit [Ping timeout: 272 seconds]
nojb_ has quit [Ping timeout: 244 seconds]
<gasche>
octachron: I would like to work on names for warnings
<gasche>
(because I find that +31 is not a good user interface)
<gasche>
but Damien seemed worried about possible downsides I didn't fully understand
<gasche>
your idea of naming/numbering errors is interesting, but I think it needs to be discussed first
<gasche>
(Alain Frisch and Damien Doligez would be the people to talk to, I think)
<octachron>
gasche, another point for warnings: having to construct a dummy warning value to test if a given warning is active seems quite inelegant
<gasche>
yes
ob_ has joined #ocaml
<gasche>
I've been thinking about GADT-ifying it
<octachron>
gasche, are GADT even needed?
<gasche>
well warnings don't all take the same parameter types
<octachron>
true, but are they frequently pattern matched?
<gasche>
I don't understand what other interface you have
<gasche>
in mind; mine is the usual sigma-type construction
<gasche>
type warning = 'a warning_tag * 'a
<gasche>
hm
<gasche>
type warning = Warning : 'a warning_tag * 'a -> warning
<octachron>
I was wondering at some point if a warning record type: type 'a warning = { id: ... ; printing: 'a -> ... } would not be enough for defining a given warning
<octachron>
and the activation/promotion to error of warning would be on warning sets
nicholasf has joined #ocaml
<octachron>
where specific set could be named to have something like "ocaml -w pedant "
Kakadu has quit []
ob_ has quit [Ping timeout: 276 seconds]
<gasche>
octachron: I prefer data to indirect behavior
<gasche>
so I think the GADT approach is better -- it is simpler, more declarative
<flux>
easier perhaps if you programmatically need to deal with the warnings in the compiler, but how about if not?
MercurialAlchemi has quit [Ping timeout: 272 seconds]
<gasche>
flux: I don't follow, I thought we were discussing the representation inside the compiler (for programmatic manipulation)
<flux>
as I understand it, warnings are usually produced at one site, and then used later for just reporting them to the user
<flux>
their contents are not really dealt with in the compiler, are they?
<flux>
in other words, they are pattern-matched ever only to be printed to the user?
<gasche>
we have a function (warning -> bool) to tell whether a warning is actually activated
hcarty1 has quit [Ping timeout: 260 seconds]
<gasche>
currently it's not very elegant because you have to build a warning value to know
<flux>
is that function then called when creating the warnings or after the compiling phase is complete?
<flux>
(seems like it would add much if-clutter if the former)
<gasche>
(there may be performance implication when checking whether a warning applies requires work)
<flux>
I guess that work cannot be just lazily attached to the warning?
<gasche>
I think that would be a possible refactoring
<gasche>
it's tricky though
<gasche>
the typing warnings (such as the example above) basically attach watchers on environment modifications
<gasche>
you can't "lazily" set that up
<gasche>
(so: thinking about it more, I'm not sure you could be lazy about these)
<flux>
well, given that code the warning_tag idea would certainly seem a good option, even if it only cleans up the crrent code a bit
<gasche>
yeah
<flux>
but the record as well sounds decent to me, as it allows to more easily extend the functionality, even if it doesn't embed such indirect facilities such as functions.
<octachron>
gasche, if there were several indirect behaviors, I would agree; but outside of warnings.ml{,i} are warnings constructor ever used as anything else than an argument to either Location.prerr_warning or Warning.is_active?
<flux>
in fact, if there isn't a record, I don't see if it's really beneficial to add the tags unless they give something that was difficult to do before..
<flux>
(but at least the other call site uses nice names when constructing an actual warning)
<gasche>
one advantage of records is that they are open-ended: in theory plugins could build their own warnings
<gasche>
(but then the usual extensibility problem: if you add more behaviors on warnings you have to update plugins)
<gasche>
flux: as you see, building a dummy warning is always doable right now, so it would be more of an aesthetic change
<gasche>
(it would also reduce the work to, say, add an argument to a warning)
<gasche>
(and allow to use private types arguments)
Nahra has quit [Remote host closed the connection]
Nahra has joined #ocaml
yunxing_ has quit [Remote host closed the connection]
yunxing_ has joined #ocaml
vgrocha has joined #ocaml
octachron has quit [Quit: Leaving]
Sorella has quit [Quit: Connection closed for inactivity]
Sorella has joined #ocaml
AlexRussia has quit [Ping timeout: 244 seconds]
<gasche>
Bluddy[m]: I don't buy your argument on the fact that there are less trolls on github, by the way
<gasche>
if you want to annoy people you can also create dummy github accounts
<Bluddy[m]>
gasche (IRC): I'm certainly not sure about it. Is it easy to create dummy github accounts?
<gasche>
well you don't have to give a real name or anything
<gasche>
furthermore
<gasche>
while online reputation matters to most people
<gasche>
(1) it also does on IRC and (2) the people that troll may not follow these rules
<gasche>
(as demonstrated by the large number of people that will post heinous comments on various websites under their very real identities)
<Bluddy[m]>
that's definitely true, and some people have terrible personalities online, but I do think it's less likely. We're not talking about politics here. On IRC it's extremely easy to create a throwaway nickname and troll.
<Bluddy[m]>
you can ban and remove people from the room, but you can't delete messages after 4 minutes. However, it seems like they're quite responsive in the gitter support room https://gitter.im/gitterHQ/gitter
AlexRussia has joined #ocaml
<gasche>
it's a different issue; the IRC log also has chans that are read-only, the point is rather to silence trolls
<gasche>
(but this was extremely unfrequently required on this chan before, so adrien was right to raise the issue but it's not something to loose sleep over)
<gasche>
that said it's also a reminder that with proprietary solutions you have even less control over the tool
al-damiri has quit [Quit: Connection closed for inactivity]
<justin_smith>
I was browsing docs and found the Marshal module; it mentions that one can encode functions, and though I don't have a real use for it I was fascinated to see it in action, but I get errors when I try to call it as documented. Is this a known issue?