ChanServ changed the topic of #ocaml to: Discussions about the OCaml programming language | http://www.ocaml.org | OCaml 4.02.1 announcement at http://ocaml.org/releases/4.02.html | Public channel logs at http://irclog.whitequark.org/ocaml
vanila has joined #ocaml
Haudegen has quit [Ping timeout: 250 seconds]
<rgrinberg> good job shilling for OCaml on HN everyone :D
jbrown has quit [Remote host closed the connection]
reem has joined #ocaml
<Algebr> rgrinberg: link?
<Drup> rgrinberg: I don't usually frequent HN, is the crowd very different from reddit ? if so, no thanks.
<Algebr> Its better than reddit.
SomeDamnBody has joined #ocaml
<vanila> is there a site better than HN?
<dmbaturin> Speaking of which, I wonder what's Graham's opinion about statically typed functional languages. He never wrote about if AFAIR.
<vanila> hes probably wise not to get into that debate, can only really lose followers
<Drup> graham ?
rgrinberg has quit [Quit: Leaving.]
Haudegen has joined #ocaml
<dmbaturin> vanila: Well, he never falls into pathological lisp advocacy, I don't think anyone would mind him participating in that debate in constructive ways.
<dmbaturin> (If calling something the most powerful language doesn't count as pathological advocacy on its own :)
<dmbaturin> Drup: Paul Graham and friends wrote hacker news in their own lisp.
mort___ has quit [Quit: Leaving.]
zpe has joined #ocaml
<Drup> https://news.ycombinator.com/item?id=9050949 <- some HNers point this guy to deriving :>
zpe has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
bytbox has quit [Ping timeout: 252 seconds]
rgrinberg has joined #ocaml
mcclurmc has joined #ocaml
reem has joined #ocaml
SomeDamnBody has quit [Ping timeout: 240 seconds]
Jefffrey has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
anemator has joined #ocaml
enitiz has quit [Quit: Leaving]
anemator has quit [Client Quit]
Algebr has quit [Ping timeout: 250 seconds]
<rgrinberg> Drup, Algebr
<rgrinberg> it's mostly the same type of people but a wider audience
swgillespie has joined #ocaml
swgillespie has quit [Client Quit]
wagle has quit [Remote host closed the connection]
<Drup> wider audience ?
reem has quit [Remote host closed the connection]
reem has joined #ocaml
<rgrinberg> well, on reddit it's mostly OCaml programmers only
<rgrinberg> even proggit is smaller than HN
<Drup> I was think r/programming, not r/ocaml
<Drup> thinking*
<rgrinberg> oh, well HN is bigger than r/programming and I *think* is more receptive to FP
<Drup> that's not difficult
<dmbaturin> Are there XML libs that support XPath? Alternatively, which XML library should I use if I need to make some internal representation out of XML data?
<Drup> dmbaturin: xmlm
<Drup> and no XPath support
<dmbaturin> Generally, I don't mind looking up nodes in the internal representation by hand, as long as creating that representation from XML is not too much headache.
moei has quit [Read error: Connection reset by peer]
moei has joined #ocaml
lordkryss has quit [Quit: Connection closed for inactivity]
oscar_toro has quit [Ping timeout: 250 seconds]
Jefffrey has quit [Quit: Leaving...]
zpe has joined #ocaml
reem has quit [Remote host closed the connection]
rgrinberg has quit [Quit: Leaving.]
darkf has joined #ocaml
ollehar1 has quit [Quit: ollehar1]
rgrinberg has joined #ocaml
zpe has quit [Ping timeout: 246 seconds]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
wagle has joined #ocaml
mcclurmc has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
rgrinberg has quit [Ping timeout: 250 seconds]
reem has joined #ocaml
rgrinberg has joined #ocaml
rgrinberg has quit [Client Quit]
ontologiae has quit [Ping timeout: 245 seconds]
ptc has joined #ocaml
ptc is now known as Guest7438
rgrinberg has joined #ocaml
antkong has joined #ocaml
Guest7438 has quit [Quit: Textual IRC Client: www.textualapp.com]
ontologiae has joined #ocaml
chinglish has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
reem has quit [Read error: Connection reset by peer]
reem has joined #ocaml
jeroud has quit [Ping timeout: 245 seconds]
jeroud has joined #ocaml
jyc has quit [Ping timeout: 245 seconds]
mekaj has quit [Ping timeout: 245 seconds]
jyc has joined #ocaml
mekaj has joined #ocaml
The_Mad_Pirate has quit [Remote host closed the connection]
jyc has quit [Ping timeout: 245 seconds]
jyc has joined #ocaml
reem has quit [Remote host closed the connection]
madroach has quit [Ping timeout: 264 seconds]
madroach has joined #ocaml
badkins_ has joined #ocaml
badkins has quit [Ping timeout: 264 seconds]
reem has joined #ocaml
keen__________63 has joined #ocaml
keen__________62 has quit [Ping timeout: 250 seconds]
prsn has joined #ocaml
<prsn> hi! I am basically a noob at ocaml, and I'm having an issue with tuareg-mode that I fear is me misunderstanding something about the language. When I type a sinle imperative line ending in ;;, tuareg mode indents the next line, which seems incorrect.
<prsn> am I missing something?
<dmbaturin> prsn: You should not use ";;" outside of the REPL. Also, ;; works as an expression separator, in sequences of statements you should use a single ;.
<prsn> ah, i see, i was reading example code that was intended for the repl
reem has quit [Remote host closed the connection]
<prsn> thanks
<prsn> though.. using a single ; seems to cause it to indent even further
<dmbaturin> If you need to call something for its side effect in the top level, use "let () = ..." matching as in let () = print_endline "hello"
<prsn> ok
bitbckt has quit [Ping timeout: 245 seconds]
<dmbaturin> As of the tuareg-mode indent issue, I can't really say anything as I don't use it. But some people here do.
hbar has quit [Ping timeout: 255 seconds]
bitbckt has joined #ocaml
bitbckt has joined #ocaml
mekaj has quit [Ping timeout: 245 seconds]
chris2 has quit [Ping timeout: 245 seconds]
reem_ has joined #ocaml
mekaj has joined #ocaml
struktured has quit [Read error: Connection reset by peer]
_habnabit has quit [Ping timeout: 245 seconds]
struktured has joined #ocaml
_habnabit has joined #ocaml
q66 has quit [Quit: Leaving]
hbar has joined #ocaml
alpen has quit [Ping timeout: 245 seconds]
mawuli has quit [Ping timeout: 245 seconds]
struktured has quit [Remote host closed the connection]
alpen has joined #ocaml
struktured has joined #ocaml
robink has quit [Ping timeout: 245 seconds]
rossberg has quit [Ping timeout: 245 seconds]
chris2 has joined #ocaml
rossberg has joined #ocaml
mawuli has joined #ocaml
robink has joined #ocaml
badkins_ has quit []
ggole has joined #ocaml
reem_ is now known as reem
mekaj has quit [Ping timeout: 245 seconds]
mekaj has joined #ocaml
alpen has quit [Ping timeout: 245 seconds]
hbar has quit [Ping timeout: 256 seconds]
alpen has joined #ocaml
bjorkintosh has quit [Ping timeout: 252 seconds]
bjorkintosh has joined #ocaml
hbar has joined #ocaml
hbar has quit [Ping timeout: 256 seconds]
<prsn> What does "<|b|>" in ocamldebug source context mean? (it's not there in the sourcefile)
hbar has joined #ocaml
swgillespie has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
slash^ has joined #ocaml
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
<whitequark> breakpoint, perhaps?
<prsn> having played with it more, i think it's more like an indicator of where execution is, but there's also <|a|> and I don't know the difference
Submarine has joined #ocaml
Submarine has joined #ocaml
Simn has joined #ocaml
Kakadu has joined #ocaml
SomeDamnBody has joined #ocaml
SomeDamnBody has quit [Ping timeout: 250 seconds]
tane has joined #ocaml
mort___ has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
Submarine has quit [Quit: Leaving]
govg has quit [Ping timeout: 245 seconds]
rgrinberg has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
AlexRussia has joined #ocaml
reem has quit [Remote host closed the connection]
govg has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
tokenrov1 has joined #ocaml
smondet_ has joined #ocaml
jlouis_ has joined #ocaml
myst|wor1 has joined #ocaml
flasheater has joined #ocaml
bitemyap1 has joined #ocaml
tizoc` has joined #ocaml
dmbaturin_ has joined #ocaml
trystero has joined #ocaml
tristero has quit [*.net *.split]
myst|work has quit [*.net *.split]
bugabinga has quit [*.net *.split]
tokenrove has quit [*.net *.split]
tizoc has quit [*.net *.split]
bitemyapp has quit [*.net *.split]
dmbaturin has quit [*.net *.split]
jlouis has quit [*.net *.split]
smondet has quit [*.net *.split]
thizanne has quit [*.net *.split]
thizanne has joined #ocaml
contempt has quit [Disconnected by services]
contempt has joined #ocaml
reem has joined #ocaml
reem has quit [Ping timeout: 245 seconds]
igstan has joined #ocaml
igstan has quit [Client Quit]
mawuli has quit [Ping timeout: 245 seconds]
rossberg has quit [Ping timeout: 245 seconds]
rossberg has joined #ocaml
mawuli has joined #ocaml
gargaml has joined #ocaml
reem has joined #ocaml
lordkryss has joined #ocaml
bitbckt has quit [Ping timeout: 245 seconds]
jyc has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
struktured has quit [Read error: Connection reset by peer]
igitoor has quit [Ping timeout: 245 seconds]
struktured has joined #ocaml
igitoor has joined #ocaml
_habnabit has quit [Ping timeout: 245 seconds]
bitbckt has joined #ocaml
bitbckt has quit [Changing host]
bitbckt has joined #ocaml
_habnabit has joined #ocaml
jyc has joined #ocaml
<gasche> prsn: before/after I suppose
_habnabit has quit [Ping timeout: 245 seconds]
<gasche> (I used the debugger recently; it's rather nice (although Emacs seemed confused about locations), but I still wouldn't use it very often)
etehtsea has joined #ocaml
etehtsea has quit [Max SendQ exceeded]
_habnabit has joined #ocaml
igitoor has joined #ocaml
igitoor has quit [Changing host]
oscar_toro has joined #ocaml
oscar_toro1 has joined #ocaml
AlexRussia has quit [Ping timeout: 244 seconds]
AlexRussia has joined #ocaml
asQuirreL has joined #ocaml
<adrien> gasche: hey, any input on http://caml.inria.fr/mantis/view.php?id=6773 ?
<asQuirreL> hey guys, does anyone here use Tuareg+Emacs? I'm getting odd behaviour with the syntax highlighting and I was wondering if anyone had experienced it before: https://www.dropbox.com/s/b82t4hnf6uwdu2r/Screen%20Shot%202015-02-15%20at%2010.50.25.png?dl=0
|jbrown| has joined #ocaml
leowzukw has joined #ocaml
Nahra has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
reem has joined #ocaml
<flux> maybe it's your color setup somehow. you could try going over one of the symbols and using M-x customize-face on it.
<Drup> asQuirreL: what are the problems ? =')
<asQuirreL> flux, yeah thanks, that's essentially what I ended up doing, the default operator syntax highlighting set its own background for some reason, so I removed it
<Drup> a part from the weird background
<asQuirreL> Drup, just the weird background :P
<asQuirreL> I found it quite distracting
<Drup> ah, yeah, that's just your specific color-theme
<Drup> tuareg doesn't do anything about it, I'm not sure how you managed to have that
<asQuirreL> Yeah... previous faces didn't have that issue... but looking at the tuareg source, they are using this (background light) function, which I feel may be the source of the issue
<Drup> hum, that's surprising
<asQuirreL> (but then when I switch to the light version of my theme, the operators are still highlighted but now in a shade of yellow which is actually darker than the background)
<asQuirreL> and evaluating (background light) myself gives me a void-function error, but I'm willing to leave this as an unsolved mystery...
<gasche> adrien: it's on the list of things I must not be because I do not have the time
<gasche> I'll let other people discuss the thing -- I only merge when it's ok to do so
<gasche> that said, I'm fine with your project
<gasche> it's not clear from your description whether the targets world.opt and install are changed or not
Submarine has joined #ocaml
Submarine has joined #ocaml
<adrien> no, they aren't
<gasche> (but I don't understand why they would be; I would rather expect the *internal* build steps to change)
<gasche> that was my only potential qualm
<adrien> gasche: only one question : do you use the debugguer to debug the compiler? and if so, how do you spawn it? :)
Haudegen has quit [Ping timeout: 245 seconds]
<gasche> no
<adrien> thanks
Haudegen has joined #ocaml
antkong has quit [Ping timeout: 250 seconds]
thorsten` has quit [Ping timeout: 240 seconds]
thorsten` has joined #ocaml
Nahra has joined #ocaml
Guest29895 is now known as andreypopp
ebzzry has quit []
ebzzry has joined #ocaml
darkf_ has joined #ocaml
darkf has quit [Ping timeout: 252 seconds]
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
reem has quit [Remote host closed the connection]
jcdyer has joined #ocaml
matason has joined #ocaml
asQuirreL has joined #ocaml
darkf_ is now known as darkf
w0rp has quit [Read error: Connection reset by peer]
w0rp has joined #ocaml
asQuirreL has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
asQuirreL has joined #ocaml
baz_ has joined #ocaml
tane has quit [Quit: Verlassend]
c74d has quit [Ping timeout: 252 seconds]
jcdyer has quit [Ping timeout: 265 seconds]
reem has joined #ocaml
reem has quit [Ping timeout: 250 seconds]
ontologiae has joined #ocaml
matason has quit [Ping timeout: 245 seconds]
oriba has joined #ocaml
mort___ has quit [Quit: Leaving.]
tizoc` is now known as tizoc
baz_ has quit [Quit: baz_]
oriba_ has joined #ocaml
oriba_ has quit [Client Quit]
oriba has quit [Ping timeout: 264 seconds]
oriba has joined #ocaml
RossJH has joined #ocaml
hekmek has joined #ocaml
enitiz has joined #ocaml
leowzukw_ has joined #ocaml
leowzukw has quit [Ping timeout: 246 seconds]
oriba has quit [Quit: Verlassend]
prsn has quit [Quit: Lost terminal]
ollehar1 has joined #ocaml
ontologiae has quit [Ping timeout: 265 seconds]
mort___ has joined #ocaml
hilquias` has joined #ocaml
mort___ has quit [Client Quit]
hilquias has quit [Ping timeout: 255 seconds]
ebzzry has quit [Remote host closed the connection]
mcclurmc has joined #ocaml
<adrien> what's ocamlbuild*light* for?
<adrien> I don't remember well
<adrien> (it's in the compiler)
<adrien> jpdeplaix, gasche ^
<adrien> main difference is that it doesn't depend on Unix
<adrien> which was useful for the bootstrap
<adrien> and I wonder if it's still useful
Anarchos has joined #ocaml
Thooms has joined #ocaml
Submarine has quit [Ping timeout: 244 seconds]
q66 has joined #ocaml
tane has joined #ocaml
jcdyer has joined #ocaml
mcclurmc has quit [Read error: Connection reset by peer]
mcclurmc has joined #ocaml
wwilly has joined #ocaml
The_Mad_Pirate has joined #ocaml
<adrien> also, is there anyone using ocamlbuild on a setup which doesn't have Unix?
<adrien> mrvn: ^
reem has joined #ocaml
mcclurmc has quit [Remote host closed the connection]
reem has quit [Ping timeout: 265 seconds]
SomeDamnBody has joined #ocaml
tnguyen has joined #ocaml
tnguyen has quit [Client Quit]
kandu has quit [Remote host closed the connection]
<Anarchos> adrien yes
<whitequark> what is that?..
<Anarchos> adrien oh you mean the Unix module ?
<Anarchos> i have the Unix module available, though not on a *nix/*nux platform
kapil__ has quit [Quit: Connection closed for inactivity]
<whitequark> yes
darkf has quit [Quit: Leaving]
govg has quit [Quit: leaving]
petrus has joined #ocaml
sivoais has quit [Ping timeout: 255 seconds]
SomeDamnBody has quit [Ping timeout: 246 seconds]
chinglish has joined #ocaml
sivoais has joined #ocaml
kandu has joined #ocaml
MercurialAlchemi has joined #ocaml
<adrien> Anarchos: yes, I was asking about the Unix module
mcclurmc has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
ontologiae has joined #ocaml
Submarine has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
Anarchos has quit [Ping timeout: 246 seconds]
waneck has joined #ocaml
mort___ has joined #ocaml
Haudegen has joined #ocaml
enitiz has quit [Quit: Leaving]
enitiz has joined #ocaml
chinglish has quit [Ping timeout: 264 seconds]
chinglish has joined #ocaml
keen__________64 has joined #ocaml
keen__________63 has quit [Ping timeout: 245 seconds]
<jpdeplaix> adrien: I don't know :/
<adrien> thanks :)
<adrien> you're actually proving that it can be removed ;-)
<Drup> wasn't it used at some point to build camlp4 ?
<Drup> or the tk thingy
<adrien> in our youth
<adrien> ocamlbuild was used to build camlp4
<adrien> and ocamlbuild bootstrapped itself
<Drup> :|
<adrien> since bytecode is only portable modulo Unix stubs, it was useful
<adrien> now camlp4 isn't built with ocamlbuild anymore
<adrien> it's not part of the distribution anymore
<adrien> and ocamlbuild doesn't bootstrap itself anymore
<adrien> (and the files have disappeared from boot/ too)
Haudegen has quit [Ping timeout: 252 seconds]
mcc has joined #ocaml
<whitequark> what do you think of it?
Haudegen has joined #ocaml
Simn has quit [Ping timeout: 252 seconds]
<adrien> XL already weighed in on that I think
<adrien> brb
<whitequark> where?
Thooms has quit [Read error: No route to host]
Thooms has joined #ocaml
<adrien> (teasing)
enitiz has quit [Read error: Connection reset by peer]
<adrien> whitequark: commenting on mantis now
trystero is now known as tristero
oriba has joined #ocaml
Simn has joined #ocaml
Anarchos has joined #ocaml
rgrinberg has joined #ocaml
<Anarchos> Does Map.iter modify in-place ?
MooseAndCaml has joined #ocaml
<Drup> of course not, Map is not mutable
<mrvn> Map.iter doesn't modify at all
<mcc> anarchos: what do you mean by "modify"? Map.iter returns type unit
<mcc> anarchose:as does its argument function
<MooseAndCaml> Hi, can some one decipher this "Error: This expression has type Narr.n list but an expression was expected of type n list Type Narr.n is not compatible with type n" .. Both this function and n are inside the module Narr
<mrvn> did you use Narr.n somewhere inside Narr?
<Drup> MooseAndCaml: pastebin the whole module please
<mrvn> if you use the module name inside a module then ocaml gets confused
<MooseAndCaml> Here is that. I am avoiding using the module name inside - https://gist.github.com/caseybasichis/56579a9ac1b52ab7697e
chinglish has quit [Quit: Nettalk6 - www.ntalk.de]
<Drup> (fwiw: next time, add .ml, it will give syntactic coloration)
hekmek has quit [Quit: Verlassend]
<mcc> mooseandcaml: on what line is the error?
<MooseAndCaml> oof.. I forgot the module name is my toplevel test -- let b = inject_vel_var (L1.hd a);; Its working with let b = Narr.inject_vel_var (L1.hd a);;
<Drup> it's in the top level
<Drup> let met guess, you loaded something twice and you open the old one only
mort___ has quit [Quit: Leaving.]
<MooseAndCaml> i don't know. I think that error is just the module. Though the last function in that code is delivering an empty list.. Is that not a workable scoping for acc in inject_vel_var?
<Drup> it's pretty hard to tell without knowing what you did exactly, and we can't test without the rest of the code.
Thooms has quit [Quit: WeeChat 1.0.1]
<MooseAndCaml> For, writing it out helped me out of that rut, Ill keep at it. Thanks
<Drup> (by curiosity, what are you doing with midi ? :D)
leowzukw has joined #ocaml
leowzukw_ has quit [Ping timeout: 252 seconds]
<MooseAndCaml> Right now midi is just a convenient format for a narrative idea I'm working on. Lets me do some gruesome annotation work in a music sequencer
rgrinberg has quit [Quit: Leaving.]
ontologiae has joined #ocaml
<mcc> neat
ontologiae has quit [Ping timeout: 252 seconds]
leowzukw has quit [Quit: Lost terminal]
<mcc> whitequark: so atm i am just trying to decide how many exception types to make
<mcc> whitequark: because there are various kinds of errors that can happen, and sometimes i care about the distinction between errors, and sometimes i do not
<mcc> so like, there could be a "program is incomplete" error, or a reader error, or a macro/parsing error, or an error during execution
<mcc> and if i had four exception types then catching them all gets messy
<mcc> what i wound up doing is making a CompilationError and there's gonna be an ExecutionError
<mcc> (apologies for lack of underscores)
<mcc> and the constructor for CompilationError takes an enum that's like Incomplete|Invalid|Macro or something
<mcc> so then i just match on that
<mcc> what's frustrating
<mcc> is i'm concerned at some point macros might have complex structure to their errors
<Drup> is making lot's of different errors really worse than making an error with lots of sub errors ?
<mcc> Yes.
<Drup> I.. don't really see how, but ok ^^
<mcc> Because in those situations where I don't care about sub-errors, I can pattern-match away the sub-error part.
<mcc> If I _ that field it becomes one single exception catch. Right?
ghostpl has joined #ocaml
<Drup> well, you can catch all errors too
qqr_ has joined #ocaml
<Drup> but I suppose you have a common part with locations and all that, right
<mcc> okay, maybe this is what i am missing. how do i do that?
<Drup> try .. with e -> do_things_with e
<Drup> it will catch all errors
<mcc> huh, ok
<mcc> is e an "object"?
<Drup> it's an exception
<mcc> is this the promised "objective" in "objective caml"?
<mcc> okay
<ggole> Exceptions are just values
<mcc> yes, but normally i can't have an "e" and "e is either an int, or a string"
<ggole> They're basically an open ended variant
<Drup> sure you can have a "e"
<Drup> let x = Failwith "bla"
<Drup> there you go
<Drup> you have an exception
<Drup> you can even pattern match on it
<mcc> but it sounds like I can have an "e" and "e is either a CompilationError, or an ExecutionError, or a Sys.Break"
oriba has quit [Quit: Verlassend]
<ggole> If you want those things and nothing else, you need a type for that
reem has joined #ocaml
rand000 has joined #ocaml
<ggole> But you might as well just define them as exceptions (unless there's something I'm missing)
<mcc> so if I say "try ... with e -> do_things_with e" ... inside do_things_with e, how do I pattern-match e to discriminate it into a CompilationError or a Sys.Break?
<ggole> Just match on it
<Drup> match e with ...
<ggole> You'll have to have a catch-all clause because exceptions are open
<mcc> ok cool
<ggole> But other than that, it's just matching
<whitequark> try .. with CompilationError | ExecutionError | Sys.Break ->
<whitequark> also works
<Drup> indeed
<mcc> i am trying to understand what kind of language construct this is-- the "open ended variant" idea. are there open ended variants other than exceptions in this language, or is exception special because it is useful to make it special?
<Drup> it was a special case until 4.02
<Drup> now, you can define new open variants
<ggole> You can encode them manually
<ggole> But it's a bit strange
swgillespie has joined #ocaml
<mcc> uh oh
<mrvn> are exceptions now open types or still their own magic?
<Drup> mrvn: open types
<mcc> so i want to look for open types in the manual if i want to understand this
<Drup> from the typing point of view at least
<mcc> May I express the opinion that this language seems to have added a BUNCH of features between 4.01 and 4.02
<mcc> Like I think even Rust would blush at this
<mcc> thank you drup
<mcc> i mean , i like the new features, but
<Drup> not that much
<Drup> and the important fact is that the new features don't disturb the old ones
<whitequark> mcc: only language extensions really, and nothing backwards-incompatible
<mcc> "type +=!" wow.
<mcc> unless you count removing ocamlp4 from the stdlib as backwards-incompatible :)
<whitequark> although i don't think 4.00.0 also added anything incompatible
<ggole> Like I said, open types are already possible with an encoding (and people were doing that)
<mcc> okay so. is it ocaml policy that if a backward incompatible change were made, that would be a major-number revision?
<mcc> oh.
<ggole> Formalizing it as a nice clean feature is probably good.
<Drup> whitequark: it breaks things by changing the typechecking algorithm
<mcc> what is an "encoding"?
<whitequark> Drup: ah.
<whitequark> mcc: so, presumably, yes.
<mcc> one more question, although i think i can guess the answer. Why does Ocaml write it 4.01 instead of 4.1?
<Drup> mcc: to be precise, the ocaml policy is basically to never break compat
<mcc> ok
<ggole> Where you define what might be a built-in construct in terms of the existing constructs
swgillespie has quit [Client Quit]
<ggole> Sometimes in obscure ways
reem has quit [Ping timeout: 250 seconds]
<Drup> mcc: except for undocumented internal matters
<Drup> (like people using the internal representation and stuff like that)
<mcc> guh
<Drup> (then, no fucks are given)
<mcc> Noted: Fucks, no
<ggole> mcc: this goes into it a bit https://blogs.janestreet.com/rethinking-univ/
<ggole> (Although I'm probably leading you down a bit of a rabbit hole here...)
<mcc> well, it's interesting from a language design perspective
<mcc> so i think... the thing that was really frustrating me with exceptions
swgillespie has joined #ocaml
<Drup> mcc: an example of encoding is, for example, to encode sum types in arrays where the first element is an integer
<Drup> you can totally do sum types in C with that
<Drup> (it's arguably insane, but you *can*)
<mcc> drup: i'm sorry you've lost me
<Drup> give me a sec !
<mcc> ok
<mcc> so, i sit down and i think: I need an exception for "run failed". it could be of type "incomplete program", "invalid program", "failure during execution".
rgrinberg has joined #ocaml
<mcc> so okay, i will make an exception, and i will give it an enum for Incomplete|Invalid|ExecuteFail
<mcc> but then i realize i cannot do that, because the ExecuteFail should have some additional informaiton along with it, but that information uses types which haven't been defined yet. i have a module dependency issue.
<mcc> the module that defines the types relevant to an execution failure has to come after the module where this exception is defined.
<mcc> i then realized that actually, there are totally unrelated reasons why it is not a good idea to pack the "couldn't parse program" and "failed at runtime" into a single exception type.
<mcc> So... actually, everything is okay.
<mcc> But! I feel like that was a coincidence. If things were just a little different, I'd want one exception type but be forced into two solely for module ordering reasons.
<mcc> But...
<ggole> Usually you would define the exceptions in that module
<ggole> Or do something sloppy like use strings
<mcc> could i be like... exception UnifiedException = .. , say type UnifiedException += ExceptionKind1(blah), and then in a different module just say type OtherModule.UnifiedException += ExceptionKind2(blah2)?
<Drup> don't do that, you will hate yourself when trying to introspect your exceptions
<mcc> I believe you
<Drup> (the string thingy)
<whitequark> mcc: you can. type desc = ..;; exception Unified_exception of desc
<Drup> mcc: for exceptions, you don't need "+="
<whitequark> then in some other module type Unified.desc += Exception_kind_1 of blah
<mcc> drup: okay, i guess see about the encoding, that is... odd
<Drup> mcc you say it's odd, however lot's of C programmers are doing exactly that, in one way or another
<Drup> manually
<mcc> drup: yes but... that is why i am writing ocaml in the first place
<Drup> oh sure
<mcc> drup: so i don't have to do the terrible things i do in c
<Drup> you are asking what is an encoding
<mcc> ok understood
<mcc> and you already told me encodings are weird
<Drup> it's crafting one feature into another :p
<mcc> whitequark: there's... so the difference there is that I have to add the constructor each time?
<Drup> (and btw, this exactly how sum types are compiled)
<mcc> or…
<mcc> oh! oh i see now. cool.
mcclurmc has quit [Remote host closed the connection]
<mcc> The way it converts uncaught exceptions to strings seems odd
<whitequark> what does? O_o
<whitequark> oh
<Drup> (note that with depends types, you can make this encoding as safe as normal sum types n__n)
<whitequark> yeah
<ggole> The toplevel? Yeah.
<ggole> It's type driven, so where the type is abstract it just falls over and cries
<whitequark> you can make it smarter, eg print your variants, with Printexc.register_printer
<whitequark> so it will be Foo (Variant, "x") instead of Foo (123, "x")
mcclurmc has joined #ocaml
<mcc> whitequark: oh, that is neat
<mcc> Token.CompilationError(1, _, "Unrecognized symbol %") why _?
<mcc> does it just do that for any structure type it doesn't know how to print?
<whitequark> yes
<mcc> this is all very helpful, thank you all
<whitequark> it knows how to print longs and strings
<whitequark> longs = char, int, bool, argumentless variants
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
mcclurmc has quit [Ping timeout: 252 seconds]
<mcc> 'k
<ggole> It's looking at the runtime representation of int-or-pointer and guessing how to print it
<ggole> Which is pretty damn nasty
<mcc> yes, that sounds hard
<mcc> ...wait, hold on
<mcc> how does it know Token.CompilationError is a Token.CompilationError, then?
<Drup> it doesn't
<ggole> The type is known
<mcc> is this because of exception's special open-typeness?
<Drup> oh, the exception, they have a special table, don't they ?
<ggole> Oh, exceptions
<mrvn> same way it knows that a type t = Foo | Bar | Baz is a Foo
<ggole> They have a special thing, right
<Drup> to be sure that dynlinking works
<Drup> (among other things)
<mcc> mrvn: the thing is, it knows Token.CompilationError is a Token.CompilationError, but it doesn't know that the first argument to CompilationError's constructor is a Token.IncompleteError, it prints "2"
<mcc> or whatever
<ggole> It's a bit limited in some ways
<mcc> i just… is it the case then that the reason it can decode CompilationError but not IncompleteError because of exception specialness?
<ggole> An example of funny printing
<mcc> oh
<mcc> what's that do? :O
<ggole> It shows how exceptions are printed "one deep"
<mcc> Got it.
<mcc> thx
<ggole> toplevel printing isn't the most obvious of subjects.
<mcc> I can imagine :O
<Drup> It's a bit voodoo
<mcc> Honestly, if toplevel printing worked much better than this, i think i'd be annoyed
<Drup> "I will look at the runtime representation and guess"
<mcc> because it would imply the toplevel giving itself polymorphism abilities that it didn't expose to the code.
<mcc> the rest of us plebs have to use ppx_deriving
<mcc> (which is very nice, btu)
<whitequark> Drup: no it's not a special table
<whitequark> open types have a string description inside them
<Drup> it's less efficient than normal variants then
<Drup> or rather, less compact
<mcc> *thinks* is that necessarily the case? if the strings are unified, then a string description is just the cost of a pointer.
<mcc> …or wait, are the tags in tagged unions less than 32 bits
<mcc> someone said they cap at 128 or something
<Drup> if all the constructor are constants, it's a full int
<Drup> so 63 bits
<Drup> if not, it's less than that, don't remember the details
<ggole> Non-nullary variant tags are limited to, uh, 253 or something like that
<mcc> 'k
<ggole> Exceptions don't use those afaik
oscar_toro1 has left #ocaml [#ocaml]
<mrvn> wasn't that just 32bit?
<ggole> Might have been?
<mrvn> 64bit has more bits in the GC word.
matason has joined #ocaml
<ggole> I think that the exception representation is tag word + cookie word + string pointer and then args
<mrvn> ggole: exceptions use open types now so that might have changed
<whitequark> it had
<mcc> is ocaml32 still supported
<whitequark> sure. there aren't two separate ocamls
<ggole> No, that's not right: I got confused by the assembly
<ggole> tag word + cookie word + args
<ggole> The cookie is unique for each exception definition, even if they have the same name (and including functor applications)
<Drup> Use open types, they have cookies ! :O
<ggole> It's an interesting little wrinkle in the implementation
<whitequark> yeah. cookie is for dynlinking
<whitequark> as well
<mcc> dynlinking sounds hard
<whitequark> not really
<mcc> well, linking sounds hard
<mcc> C's pretty bad at it anyway
<ggole> The cookie is also for ruling out incorrect matches iirc
<ggole> If you have a functor application F, it shouldn't catch the exception thrown from functor application G even though they come from the same line of source
qqr_ has quit [Quit: Leaving]
<ggole> So they are allocated unique ids (dynamically)
<ggole> Bit strange since it all looks static in the source
<whitequark> mcc: ocaml's good at linking.
<whitequark> and will be even better soon
<Drup> whitequark: you are refering to first class dynlink ?
<mcc> cool
<whitequark> yes
<Drup> yep
bitemyap1 is now known as bitemyapp
JuggleTux has quit [Ping timeout: 264 seconds]
<mcc> any idea what i'm doing wrong here? I just wanted to get the exception tuple as a tuple. can I not do that? :O https://gist.github.com/mcclure/f9723e7294a02c535b31
<whitequark> no
<whitequark> there is no tuple
<whitequark> *stares intensely*
<ggole> It's like variants, they are arguments
<mcc> oh
<mcc> i thought i'd extracted a tuple out of a variant before
<whitequark> ggole: that's a very rationalizing explanation :]
<whitequark> mcc: that works with polymorphic variants
<whitequark> that doesn't work with normal variants because [bogus reasons]
<mcc> okay.
<ggole> If you want the whole exception value, then with Foo as e -> do_thing e
<whitequark> basically xavier leroy didn't like it
<whitequark> that's all
<Drup> whitequark: that works perfectly fine with variants .. if you had parens
<ggole> There's a performance issue, it wasn't an oversight
<Drup> type foo = Foo of int * int <- doesn't work
<whitequark> ggole: it's a syntactic issue
<Drup> type foo = Foo of (int * int) <- works
<whitequark> purely
<Drup> whitequark: it is *also* a memory representation thing
<ggole> Go and look up the Cardelli optimisation
<Drup> the two type I defined are not represented the same way
<Drup> mcc: to answer your question, put parens around the type part of the exception definition
<Drup> yes, it's insane, I agree, but it will work
slash^ has quit [Read error: Connection reset by peer]
Thooms has joined #ocaml
<whitequark> Drup: you can have the same representation.
<whitequark> the only thing you need to do is allocate when you match | Foo e, where Foo is many-argument
<mcc> ...oh
<mcc> so what i was about to say, what I just did was I changed the pattern to "Token.CompilationError _ as e"
<mcc> and then just altered errorString to take an exn
<Drup> that's another question, and if you are willing to write a patch to get rid of the difference, then you will gain a free drink from be
<Drup> from me*
JuggleTux has joined #ocaml
<whitequark> Drup: isn't it going to get rejected?
<mcc> Would y'all have a recommendation on whether putting parenthesis in the type definition, or just passing around the exn like that, would be better code practice?
<Drup> if there is no performance cost, no
<whitequark> ... hrm
<Drup> nicoo tried to work on something
<Drup> related
<Drup> mcc: put the parens
<Drup> it's virtually free except on very performance intensive code path
<Drup> and compiler error reports is not :)
<Drup> whitequark: let me rephrase, though : "If there is no performance cost, I thing it will be accepted" ;)
<mcc> okay.
mcclurmc has joined #ocaml
<Drup> (I have neither control, influence or even insight on the core team :D)
<ggole> Hmm, the difference would be visible with ==
<ggole> Do people care about that?
<whitequark> ggole: I am not aiming to change the memory representation
<whitequark> or was that for mcc
<ggole> The copying that you suggest is what would be visible with ==, I mean
<Drup> ggole: compile everything with opam, see if things break.
<whitequark> it wouldn't
<ggole> let f = function Foo e -> e in f x == f x
<ggole> False if it allocates.
<whitequark> write the type of f.
<mcc> == is scary
<Drup> mcc: is it ?
<Drup> well, you should almost never use it
<ggole> whitequark: this wouldn't break existing code, but the nonequality would still be visible
<whitequark> ggole: no, really, write the type of f
<whitequark> the code you wrote does not compile
<whitequark> typecheck, rather
<Drup> ?
mcclurmc has quit [Ping timeout: 246 seconds]
<ggole> Isn't it clear what I mean?
<ggole> (The 'in' is wrong, ok)
<whitequark> val f : [ Foo of int * int ] -> int * int
<Drup> once again
<whitequark> (abusing the syntax a bit)
<Drup> Foo of (int * int)
<whitequark> no
<Drup> and this code is valid
<whitequark> Foo of int * int
<Drup> I don't understand your point
<whitequark> I don't understand yours
<whitequark> ggole: oooooh
<Drup> this code is valid for a certain definition of Foo ...
<whitequark> f x == f x
<whitequark> i read that as "f x == x"
<whitequark> sorry
<Drup> ah, okay, I see
<ggole> I'm saying if you copy the tuple, the non-identity is visible. Nothing more.
<ggole> I'm not even sure whether that matters or not.
<whitequark> yes, sure, you're pointing out a valid thing
<whitequark> i just misread
<ggole> Righto.
antkong has joined #ocaml
Haudegen has quit [Ping timeout: 240 seconds]
<whitequark> ggole: well, actually, no allocation required.
<whitequark> # (Obj.magic (Foo (1,2)) : int * int);;
<whitequark> - : int * int = (1, 2)
<whitequark> the tag is not 0
<whitequark> but it doesn't matter
<whitequark> it's still a tuple
<whitequark> and you could even do away with allocating a new Foo in Foo x where x is an ex-Foo itself
<ggole> When you store it somewhere and the GC tries to relocate it you're gonna have a fun time
<whitequark> why?
<ggole> Because relocation writes over the tag word (iirc)
<whitequark> well, that would break variants too :]
<whitequark> I mean--this is a type-level trick, really
<ggole> Wouldn't polymorphic equality/hashing also want to look at the tag?
<whitequark> good point. let me see
<whitequark> equality, no
<whitequark> or rather it treats all non-special tags the same
<ggole> type t = Bar of int * int | Foo of int * int;; (Obj.magic (Bar (1,2)) : int * int) = (Obj.magic (Foo (1,2)) : int * int) => false
<ggole> It shouldn't look at the tags, so that's a problem.
<whitequark> hrm.
jcdyer has left #ocaml [#ocaml]
<whitequark> ohhhh
<whitequark> first variant has tag 0
<whitequark> not 1
<whitequark> right.
<ggole> You really have to allocate, I think
<ggole> But that should work (identity thing notwithstanding), unless I'm missing something
<whitequark> I could change compare.
<whitequark> but changing hash will not do.
<whitequark> I've seen discussions and this will not be accepted
Haudegen has joined #ocaml
<ggole> Wait, how would you change compare?
<ggole> You can't treat tuples specially unless there's some information that they are tuples
stux|RC-only has joined #ocaml
stux has left #ocaml ["Leaving"]
<ggole> You'd have to do pointer-tagging or some crap like that (so that the heap layout is identical, but there is still some discriminatory info)
<whitequark> oh
<whitequark> yeah I can't
<whitequark> allocation it is, so
<ggole> tagless GC would do it
<ggole> All you have to do is redesign the entire runtime and do a bit of research to figure out how to make it work
* ggole so helpful
<Drup> :D
c74d has joined #ocaml
ontologiae has joined #ocaml
antkong has quit [Ping timeout: 255 seconds]
matason has quit [Ping timeout: 252 seconds]
mlen has quit [Ping timeout: 255 seconds]
lightstep has joined #ocaml
mlen has joined #ocaml
SomeDamnBody has joined #ocaml
moei has quit [Quit: Leaving...]
moei has joined #ocaml
manu3000 has joined #ocaml
SomeDamnBody has quit [Ping timeout: 240 seconds]
enitiz has joined #ocaml
<whitequark> ggole: actually that's not that hard
<whitequark> i've been thinking of designing a similar runtime for my language
<ggole> You run into a bit of trouble with polymorphism and generational GC
SomeDamnBody has joined #ocaml
<ggole> It might be doable though
petrus has quit [Quit: WeeChat 1.1.1]
<Anarchos> ggole ocaml did it, didn't it ?
<ggole> Tagless GC? No.
<ggole> OCaml heap blocks have the usual tag-word.
<nicoo> whitequark, Drup : Regarding the evil parenthesis/memory representation issue, my suggestion should improve performance on 64 bits. I need to runs lots of code on 32 bits with memory profiling to know what the impact would be on those platforms (basically, I would need to bump alignment to 256 bits, which is costly, but it would possibly remove many allocations and indirections)
mcclurmc has joined #ocaml
<ggole> That would hurt a fair bit for int32, float, etc
<mrvn> 32 byte per box? That would double the memory for small blocks on 64bit.
zpe has joined #ocaml
wwilly has quit [Quit: Leaving]
mcclurmc has quit [Ping timeout: 245 seconds]
<flux> my gawd, sounds like PHP ;-)
zpe has quit [Remote host closed the connection]
<flux> apparently an integer variable on PHP on a 64-bit platform takes.. 188 bytes :-o. and 72 bytes for 32-bit. that information must be wrong..
<mrvn> whitequark: 'Foo of int * int' and 'Foo of (int * int)' can not have the same representation because of: type t = Foo of (int * int) | Bar of (int * int) let t = (1, 1) let foo = Foo t let bar = Bar t
<flux> ah, 96 bytes comes from the fact it's put to a new bucket in a hash table, so that's a probabilistic cost. still, 48 bytes remains..
<mrvn> type m = { mutable x : int; } let t = ({x = 1}, {x = 2}) let foo = Foo t let bar = Bar t let (x, y) = t let () = x.x <- 2 (foo, bar)
<mrvn> flux: allocate 1000 of them and average
ggole has quit []
enitiz has quit [Ping timeout: 240 seconds]
<whitequark> mrvn: I never suggested giving them same representation
<mrvn> did I get the nick wrong?
lightstep has quit [Ping timeout: 250 seconds]
<flux> mrvn, I think I can safely let the opportunity of looking into PHP memory consumption pass.
<whitequark> mrvn: I think you've misunderstood me, rather
<whitequark> I meant giving Foo of int * int and int * int same representation
<mrvn> flux: past experience showed me ocaml needs 1x memory, perl 2x, python 4x.
<whitequark> or rather, that they only differ by tag
enitiz has joined #ocaml
matason has joined #ocaml
<mrvn> whitequark: which means Foo t and Bar t would both just set the tag and Bar would overwrite Foos tag. Or Foo and Bar copy the tuple destroying that it was shared before.
<mrvn> whitequark: or would you still have Foo of int * int and Foo of (int * int)?
antkong has joined #ocaml
vanila has quit [Quit: Leaving]
antkong has quit [Ping timeout: 250 seconds]
mcclurmc has joined #ocaml
<whitequark> the latter
<mrvn> then what you want is already the case.
<whitequark> what i wait is: type t = Foo of int * int; match Foo (1,2) with Foo x -> x
<whitequark> note the distinct lack of parentheses
<mrvn> which already has the same memory representation
<mrvn> Note that "Foo x -> x" needs an allocation to keep polymorphic comparisons working.
<Drup> whitequark: if you don't change the memory representation and do a copy during the pattern match, the argument is going to be that the copying is not syntactically visible in the program, you need to go and look how Foo is defined
<Drup> and it's a rather valid point
<Drup> (the argument against inclusion)
<mrvn> Drup: the memory representation is already the same
pyon has quit [Quit: fix]
<mrvn> and the copying is hapening.
<Drup> between Foo of int * int and Foo of (int * int) ?
larhat has quit [Quit: Leaving.]
<mrvn> Drup: so what exactly would change?
<whitequark> mrvn: yes, you are right, and that's what we figured out already
<mrvn> Drup: no, those two are different in memory and behaviour
<Drup> yes, my point
<mrvn> whitequark: ok. then we all agree
<struktured> can one define <- and .() operators? I http://www.lexifi.com/blog/about-unboxed-float-arrays does it but does I get a syntax error in practice
<whitequark> Drup: you can't generally predict allocations based on source alone
<whitequark> Drup: Int64 plus inlining, for example.
Guest52968 has joined #ocaml
<Drup> hum, that's true
<Drup> (you can guess pretty well, though)
<whitequark> and I think there was some similar case with a hidden allocation
<whitequark> but I can't recall
<Drup> well, if there is another case, maybe it's worth trying
reem has joined #ocaml
<whitequark> I really do think that Foo x -> x should work regardless of Foo's arity
<whitequark> it's just consistency
Guest52968 has quit [Changing host]
Guest52968 has joined #ocaml
Kakadu has quit [Read error: Connection reset by peer]
<mrvn> like Foo _
Guest52968 is now known as pyon
pyon has quit [Client Quit]
<whitequark> kinda
<Drup> I agree with you, but my argument is more about intuitivity and accessibility for beginners
<Drup> (well, it's more or less the same argument)
pyon has joined #ocaml
swgillespie has joined #ocaml
reem has quit [Ping timeout: 250 seconds]
swgillespie has quit [Max SendQ exceeded]
swgillespie has joined #ocaml
badon has quit [Disconnected by services]
badon_ has joined #ocaml
badon_ is now known as badon
enitiz has quit [Ping timeout: 245 seconds]
<mrvn> how about 0.0 releases?
struktured has quit [Ping timeout: 265 seconds]
mcc has quit [Quit: This computer has gone to sleep]
enitiz has joined #ocaml
<nicoo> mrvn: You only pay the alignment constraint on 32 bits. 64 bits pointers have enough unused bits to store the tag in there
lordkryss has quit [Quit: Connection closed for inactivity]
dmbaturin_ is now known as dmbaturin
<mrvn> nicoo: uhoh, storing data in the top bits? That's gonna slow you down and bite you in the future.
<mrvn> nicoo: you need more than 5 bits?
<mrvn> more than 3?
matason has quit [Ping timeout: 264 seconds]
zpe has joined #ocaml
<Drup> nicoo: isn't that the same sort of technique that ocp-memprof is using ?
<nicoo> Drup: I don't know what memprof does
<Drup> exactly that, store things in this unused space
<whitequark> ARM64 dedicates 8 top bits for tags explicitly
<nicoo> mrvn: The mask operation are fairly inexpensive (the runtime even does something similar for ints). And you need enough bits to recognize any (non-constant) constructor. I don't remember how many
raphaelss has quit [Quit: leaving]
<nicoo> whitequark: In practice, amd64 only uses 56 bits of adress space max. (As in "the MMU cannot do more than that")
<nicoo> (IIRC, for the 56 value)
<whitequark> yes, I know
<nicoo> Drup: How do they make it work on 32 bits systems, then ? (Or do they only need very few bits?)
<whitequark> iirc it is 48, but not sure
<whitequark> but you still need masking
<whitequark> because any of these bits set means a fault
zpe has quit [Ping timeout: 246 seconds]
<nicoo> Yup
<Drup> nicoo: they don't.
<nicoo> Drup: Ok. Because the trick would work out-of-the-box on 64 bits, but I would need some stats about allocation patterns on 32 bits to guess whether it makes sense or not (on 32 bits)
MooseAndCaml has quit [Ping timeout: 246 seconds]
tani has joined #ocaml
tane has quit [Killed (sinisalo.freenode.net (Nickname regained by services))]
tani is now known as tane
rgrinberg has quit [Quit: Leaving.]
mcclurmc has quit [Remote host closed the connection]
rgrinberg has joined #ocaml
reem has joined #ocaml
SomeDamnBody has quit [Ping timeout: 245 seconds]
mcclurmc has joined #ocaml
SomeDamnBody has joined #ocaml
mcclurmc has quit [Ping timeout: 265 seconds]
lightstep has joined #ocaml
tane has quit [Quit: Verlassend]
rkowalick has joined #ocaml
rand000 has quit [Quit: leaving]
myyst has joined #ocaml
<lightstep> is it possible to ask the compiler to forgo the monomorphism restriction for a single definition?
<Drup> considering how unsafe it is, no
myst has quit [Ping timeout: 250 seconds]
<Drup> the better question is : what are you trying to do ?
<lightstep> i have a type 'a t = Phantom | Other 'a ... and a module M with M.f : 'a -> 'a M.t, and i'd like to define phantom = M.f Phantom, as a value and not as a function
mcclurmc has joined #ocaml
<Drup> can you show the whole definition ?
<lightstep> (this is not strictly necessary but would structure my program nicely)
<Drup> (of t)
<lightstep> sure. here's a copy of the relevant parts of my code: http://lpaste.net/120566
<Drup> change the definition of Lz.t with "type +'a t"
<Drup> and tell me if it works
<Drup> (you can put the + on the definition of status and t too, just to force the compiler to check that everything is going well, but it should infer it)
<lightstep> in the module implementation: Error: In this definition, expected parameter variances are not satisfied. The 1st type parameter was expected to be covariant, but it is invariant
<Drup> ok, show the implementation of Lz
<lightstep> i'll paste that as well: http://lpaste.net/120566
<Drup> ok
<lightstep> i don't know ocaml very well... is there a formal definition for the rules of subtyping? does ref constrain the variance?
<Drup> so then, the answer is definitely no
<Drup> make never a function :)
<lightstep> in this particular case, the implementation is completely safe: the reference contains a Value and is never assigned to
<Drup> yes, but the compiler doesn't know that
<Drup> especially since the type is opaque, but even without that, it couldn't prove it
<Drup> (btw, I'm not sure why you are not using Lazy)
gargaml has quit [Quit: WeeChat 1.1.1]
<Drup> (it wouldn't help, but still)
<lightstep> yeah, for sure. that's why i was asking for a compiler trick to skip checking for one definition :)
<Drup> playing that game doesn't usually end well, especially if "[you] don't know ocaml very well" ;)
<Drup> so, no, sorry, resign yourself and make a function
<lightstep> i'm using lazyness to implement infinite streams, some of whose contents are not known in advance (to base an implementation of FRP over). they are cyclically dependent. and i use Lazy.Undefined, or Lz.Loop, to detect when a stream depends on itself, to ignore this case. (i'm using mutithreading to decide which comes first if the next element depends on multiple streams)
nuki has joined #ocaml
reem has quit [Remote host closed the connection]
<lightstep> but when using Lazy, some values cache the Undefined exception, and it's hard to control all of them and make them pass it through
<Drup> yeah, using Lazy.Undefined for that sounds like a remarkably bad idea.
<Drup> apparement, Lazy.t is declared covariant
<Drup> so never can be a value with Lazy.t
Thooms has quit [Quit: WeeChat 1.0.1]
<Drup> compiler cheating, I presume. Lot's of compiler cheating with lazy
<lightstep> yeah, it actually worked with Lazy before
<lightstep> thanks a lot anyhow
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<Drup> lightstep: not that if you role everything into one, you can have what you want
<Drup> note*
<Drup> roll* too =')
<lightstep> you mean, if the types are defined in the same module?
<Drup> and you inline Lz.t insinde status/t (you don't need the two then)
<Drup> are you doing an frp library just for fun or another reason ?
zpe has joined #ocaml
<lightstep> just for fun, i want to understand if there's a technical reason why the push-pull approach isn't popular any more
<lightstep> i can't make it work, even when i inline as much as i understand: http://lpaste.net/120566#a120570
<lightstep> i tried playing with variance but it seems that "ref" forces invariance
<lightstep> this last version still has the same error: never : _'a t doesn't match never : 'a t
<Drup> yes, ref is invariant
<Drup> an 'a ref is completely unsafe
zpe has quit [Ping timeout: 265 seconds]
mcclurmc_ has joined #ocaml
<Drup> you could do that : let x : 'a option ref = None ref in x := Some 3 ; Option.get !x ^ "bouh"
<Drup> that would typecheck
<lightstep> the compiler could make wider analyses on how the type is used in its scope. but i agree, it's completely reasonable
<Drup> not really, no. Not with ML polymorphism
mcclurmc has quit [Ping timeout: 256 seconds]
<Drup> well, you are sort of right in that we could separate immutability from variance
<Drup> currently, the compiler say "if it's covariant, then it's immutable !" and go on with that, which works ... most of the time.
<lightstep> really the only strange part is the relaxed rule for Lazy.t
<Drup> lazy is such a privileged type, living in the compiler and doing purple magic, it's unacceptable ! REVOLUTION ! è_é
<def`> the only "magic" is covariance in 'a, right?
<Drup> def`: having special runtime representation and GC custom behavior is high on the magic rating
<Drup> (but yes, covariance)
Simn has quit [Quit: Leaving]