gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
osa1 has quit [Quit: Konversation terminated!]
<ousado> hm.. the Dynlink module isn't listed as part of the std library, is it safe to assume that it's ocaml's standard approach for loading shared libs?
<ousado> (I'm referring to this list: http://caml.inria.fr/pub/docs/manual-ocaml/manual034.html )
<thelema_> ousado: technically, dynlink is not part of the standard library like List and Set, but is part of the standard library like Unix and Big_int and Str
<thelema_> meaning that it's part of the standard distribution
<thelema_> additional linking instructions are needed for dynlink
<ousado> thelema_: ah OK, I've been thinking about whether I'd have to list it as additional external dependency in a patch
wagle has quit [Ping timeout: 255 seconds]
wagle has joined #ocaml
tactics_[home] has joined #ocaml
madroach has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
gnuvince has joined #ocaml
avsm has quit [Quit: Leaving.]
rwmjones has quit [Ping timeout: 250 seconds]
ankit9_ has quit [Ping timeout: 255 seconds]
ankit9_ has joined #ocaml
hongboz has joined #ocaml
Progster has joined #ocaml
Progster has quit [Ping timeout: 252 seconds]
hongboz has quit [Ping timeout: 276 seconds]
emmanuelux has quit [Ping timeout: 252 seconds]
ankit9_ has quit [Ping timeout: 276 seconds]
hongboz has joined #ocaml
fraggle_ has quit [Ping timeout: 255 seconds]
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 276 seconds]
hongboz has quit [Ping timeout: 250 seconds]
tactics__[home] has joined #ocaml
tactics_[home] has quit [Ping timeout: 276 seconds]
tactics__[home] has quit [Ping timeout: 276 seconds]
ankit9_ has joined #ocaml
hongboz has joined #ocaml
wagle has quit [Remote host closed the connection]
ankit9_ has quit [Ping timeout: 276 seconds]
wagle has joined #ocaml
wormphlegm has joined #ocaml
wormphle1m has quit [Ping timeout: 248 seconds]
alvin-x has joined #ocaml
ontologiae has joined #ocaml
hongboz has quit [Ping timeout: 276 seconds]
pango is now known as pangoafk
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
djcoin has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
Submarine has quit [Read error: Operation timed out]
ontologiae has quit [Ping timeout: 246 seconds]
ankit9_ has joined #ocaml
sepp2k has joined #ocaml
ftrvxmtrx has joined #ocaml
rwmjones has joined #ocaml
pippijn has quit [Ping timeout: 250 seconds]
pippijn has joined #ocaml
Obfuscate has quit [Ping timeout: 265 seconds]
maufred has quit [Ping timeout: 252 seconds]
maufred_ has quit [Ping timeout: 240 seconds]
maufred has joined #ocaml
Obfuscate has joined #ocaml
maufred_ has joined #ocaml
dsheets has quit [Read error: Operation timed out]
dsheets has joined #ocaml
georg has joined #ocaml
dsheets has quit [Ping timeout: 244 seconds]
maufred__ has joined #ocaml
<georg> hello folks, I have a problem with shared libary generation on 64-bit linux using 3.12.1
<georg> When running: ocamlopt -o lib.so -fPIC -ccopt -shared lib.cmx" I get /usr/bin/ld: /usr/lib/ocaml/libasmrun.a(roots.o): relocation R_X86_64_32S against `caml_frametable' can not be used when making a shared object; recompile with -fPIC
maufred_ has quit [Read error: Operation timed out]
maufred has quit [Read error: Operation timed out]
maufred_ has joined #ocaml
<georg> It looks like the bug http://caml.inria.fr/mantis/view.php?id=4795 bit it is supposed to be fixed in 3.12.1
mika1 has joined #ocaml
xcombelle has joined #ocaml
<f[x]> georg, do you have PIC-enabled libasmrun?
ontologiae has joined #ocaml
<georg> sorry for the late reply: well I have the binary from ubuntu
<georg> I am supposed to compile libasmrun myself?
<f[x]> I guess by default libasmrun is not PIC enabled
<georg> Mh, okay, this is quite inconvinient
<georg> why are there not simply two libasmrun's ?
<georg> BTW I have ls /usr/lib/ocaml/libasmrun* results in: /usr/lib/ocaml/libasmrun.a /usr/lib/ocaml/libasmrunp.a
<f[x]> georg, I don't know
<georg> I thanks anyway
<samposm> an Array of records, it is really just an array of pointers, right?
<rixed> yes
<samposm> is there any wau to contro data locality?
<samposm> (sorry about my typos)
<samposm> ..any way to control data locality?
<rixed> no. But the compiler sometime inline data (for instance, ints or floats in an array are "inline")
<rixed> see section 18.3 for all the rules
<rixed> samposm: BTW, I don't know of a functional language where you can choose location of data, apart from ATS which is very verbose
<samposm> say we have a huge set of records. we select some (still a large number) of them and store them in an array.
<samposm> but the array is just an array of pointers.
<orbitz> I wonder if jdh's scientific computing book covers this...
<samposm> so the selected records are all over the memory, and there is now eay to copy them to a continuous piece of memory.
<samposm> so there is no way to achive any cache efficiency? (in this case)
<rixed> samposm: apart from hoping the GC will store them close together, no.
<samposm> ok
<rixed> samposm: or you resort on some C lib
<rixed> samposm: like bigarray
<samposm> but you can't make a bigarray of records
<rixed> samposm: can't you?
<rixed> too bad, then you'll have to code your own bigarray like container in C for your records :-/
<samposm> "This module implements multi-dimensional arrays of integers and floating-point numbers" http://caml.inria.fr/pub/docs/manual-ocaml/libref/Bigarray.html
<orbitz> i bet jdh's book covers this
<rixed> samposm: yes that makes sense otherwise they'd have to know the encoding of all types
Kakadu has joined #ocaml
<f[x]> you can get some locality with marshal/unmarshal
<f[x]> but extra pointer traversing is still there
<f[x]> and the usual trick of converting array of records to record of arrays also works
<orbitz> that doesn't guratnee locality of the record though
<orbitz> right?
<f[x]> what "that"?
<orbitz> as in, getting two elements form the array is still a jump
<f[x]> not if those elements are of primitive type
thomasga has joined #ocaml
<mfp> orbitz: if you deep copy the records with marshal the way f[x] said, there will be no other refs to them, apart from those in the array. In that case, the GC should keep locality as it forwards the pointers to the major heap.
<mfp> there's still an indirection, but there's a good chance the values pointed to by a.(i) and a.(i+1) are contiguous
Asmadeus has quit [Ping timeout: 252 seconds]
<samposm> where can I read about deep copying and marshalling?
Asmadeus has joined #ocaml
<mfp> man Marshal ?
<samposm> orbitz: I took a loof at "OCaml for Scientists", and could not find anything about data locality and cache things
<samposm> mfp: thanks
mcclurmc_away is now known as mcclurmc
<samposm> mfp: thanks again, I guess marshalling might be a good kludge
ontologiae has quit [Ping timeout: 276 seconds]
mnabil has joined #ocaml
fraggle_ has joined #ocaml
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
ontologiae has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
avsm has quit [Quit: Leaving.]
K_F has quit [Ping timeout: 240 seconds]
_andre has joined #ocaml
K_F has joined #ocaml
avsm has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
avsm has quit [Ping timeout: 240 seconds]
avsm has joined #ocaml
Cyanure has joined #ocaml
ankit9_ has quit [Quit: Leaving]
emmanuelux has joined #ocaml
avsm has quit [Ping timeout: 255 seconds]
avsm has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
emmanuelux has quit [Ping timeout: 272 seconds]
avsm has quit [Ping timeout: 246 seconds]
companion_cube has quit [Read error: Operation timed out]
companion_cube has joined #ocaml
Haseo has quit [Ping timeout: 250 seconds]
ztfw has quit [Ping timeout: 250 seconds]
Haseo has joined #ocaml
Asmadeus has quit [Ping timeout: 250 seconds]
deavid has quit [Ping timeout: 250 seconds]
Asmadeus has joined #ocaml
deavid has joined #ocaml
gnuvince has quit [Ping timeout: 250 seconds]
<Ptival> 4.00 is out :)
<adrien> \o/
avsm has joined #ocaml
<adrien> whe're gasche to post it on reddit? :P
<thizanne> he's probably sleeping
<adrien> gasche? :o
<thizanne> he's in oregon
<adrien> oh, I thought he was in France :P
<adrien> poor him
<thizanne> yes, he must wait hours to see the release
<adrien> he should be waking up now
<thizanne> it's 5:30 am
Progster has joined #ocaml
<djcoin> From the "changes" of 4.0: - Added option -bin-annot to dump the AST with type annotations
<djcoin> Great, any libs, usages that take or will take advantage of this ?
<adrien> definitely
<adrien> thizanne: thought it'd be later
<samposm> "ocamlfind ocamlopt.opt ..." does not work :-(
<adrien> how?
<samposm> like this: http://pastebin.com/UZ7GrFZA
<adrien> samposm: your link doesn't load for me
<samposm> pastebin seems slow to me, too
<adrien> another one
<samposm> here is the same: https://gist.github.com/3181852
<adrien> one would be ocaml 3.12, the other one 4.00?
<samposm> both are from ubuntu packages
<samposm> both ocamlopt and ocamlopt.opt are 3.12.1
<samposm> ah, the man page of ocamlfind (around line 400) tells how to spcefify a different compiler
<samposm> this works:
<samposm> OCAMLFIND_COMMANDS='ocamlopt=ocamlopt.opt' ocamlfind ocamlopt ...
gnuvince has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 276 seconds]
diego_diego has joined #ocaml
diego_diego has quit [Client Quit]
edwin has joined #ocaml
edwin has left #ocaml []
silver has joined #ocaml
alvin-x has left #ocaml []
smondet has joined #ocaml
<avsm> is anyone running macos x 10.8 and have ocaml-4.00.0+rc1 or greater installed?
<avsm> trying to track down a segfault and want to see if it happens to anyone else
emmanuelux has joined #ocaml
<Ptival> adrien: gasche is in Oregon for two weeks only (OPLSS)
<adrien> ah, ok
metadave has joined #ocaml
<NaCl> avsm: Did that happen in OSX 10.7? I don't have 10.8 to test against
ftrvxmtrx has quit [Quit: Leaving]
Yoric has joined #ocaml
akanaka has quit [Ping timeout: 252 seconds]
avsm has quit [Read error: Connection reset by peer]
avsm has joined #ocaml
mika1 has quit [Quit: Leaving.]
Yoric has quit [Ping timeout: 250 seconds]
emmanuelux has quit [Read error: Operation timed out]
Kakadu has quit [Quit: Page closed]
avsm has quit [Quit: Leaving.]
<hcarty> djcoin: ocamlspotter uses the new -bin-annot functionality
mcclurmc is now known as mcclurmc_away
mnabil has quit [Ping timeout: 244 seconds]
<djcoin> hcarty: Nice! I heard this feature was awaited/could be used for AST transformation and such. Do you know which projects could take advantage of this for this purpose ?
mcclurmc_away is now known as mcclurmc
<hcarty> djcoin: ocamlspotter uses it for IDE/editor additions (type of the expression under the cursor for example)
<hcarty> djcoin: The new -ppx option is a separate item which can be used in place for camlp4 for some items
<hcarty> djcoin: Oops - sorry, -ppx is not part of 4.00
madroach has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
<djcoin> Thanks
madroach has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
madroach has quit [Ping timeout: 265 seconds]
madroach has joined #ocaml
<thelema_> emacs integration on camlspotter?
<hcarty> thelema_: Yes, I think so
<thelema_> apparently, yes.
mcstar has joined #ocaml
<thelema_> hcarty: what's the easy way to brew ocaml 4.00?
madroach has quit [Ping timeout: 265 seconds]
<hcarty> thelema_: I'm about to put up a paste or a comment on the reddit post :-)
<adrien> brew? beer!
<thelema_> great
madroach has joined #ocaml
djcoin has quit [Quit: WeeChat 0.3.2]
<hcarty> Sorry for the delay. I wanted to test to make sure it all works for me.
madroach has quit [Ping timeout: 265 seconds]
<thelema_> no problem. I'm working on fixing batteries for 4.00
<thelema_> 4.00 takes a while to build...
<hcarty> thelema_: Developing ocamlbrew definitely made me wish for the magical appearance of parallel build support for OCaml itself
<thelema_> does anyone have a good idea on how to simulate 4.00's Sys.big_endian under 3.12?
<thelema_> I could just punt and always return false.
<thelema_> but there's got to be a better way.
ontologiae has quit [Ping timeout: 246 seconds]
<hcarty> thelema_: Could you do something with Int64.bits_of_float?
beckerb has quit [Quit: Konversation terminated!]
beckerb has joined #ocaml
<thelema_> I don't think so, I think it's the same on both big and little endian?
madroach has joined #ocaml
<hcarty> thelema_: Probably - I was about to ask :-)
<thelema_> does someone have a big-endian box to test on?
<hcarty> thelema_: Would this kind of trick work? http://rosettacode.org/wiki/Host_introspection#C
<thelema_> findlib: [WARNING] Interface topdirs.cmi occurs in several directories: /home/thelema/ocamlbrew/ocaml-4.00.0/lib/ocaml/compiler-libs, /home/thelema/ocamlbrew/ocaml-4.00.0/lib/ocaml
<hcarty> thelema_: Harmless warning according to the announcement email
<thelema_> hcarty: ok, thanks
<thelema_> as to the C tricks for testing endianness... the first one, I can't see working...
<thelema_> maybe there's something that exposes network order in Unix...
<thelema_> hmm, doesn't look like it.
beckerb has quit [Ping timeout: 248 seconds]
xcombelle has joined #ocaml
madroach has quit [Ping timeout: 265 seconds]
<thizanne> thelema_: you could write two bytes on a file, read them individually, and observe
madroach has joined #ocaml
<thelema_> ousado: union tricks won't work in ocaml... no htonl function...
<thelema_> no pointer tricks...
<thelema_> no pre-processor macros
<thelema_> ousado: I don't think this page has a solution that will work in ocaml. ocaml specifically hides these kinds of details when possible
madroach has quit [Ping timeout: 265 seconds]
<thelema_> thizanne: if I write two bytes to a file, won't I always get exactly those two bytes back?
<thelema_> in the same order?
<thizanne> no thelema_
<thizanne> well
<thizanne> it depends :D
<adrien> you could write an int
<adrien> and read back a string
<thizanne> if you write two bytes in one pass, the endianness will be taken into account
<thelema_> adrien: ocaml doesn't have a builtin that writes an int; I have to deconstruct the bytes myself.
<thizanne> and then you read from your file individually, so that the endianness is not used
<thizanne> if there is a difference, then you're not in big endian
<thelema_> thizanne: I don't think ocaml's IO works like that.
<thizanne> hmm
<ousado> thelema_: ok, I didn't get that you're looking for an ocaml only solution
<thizanne> I never tried in OCaml
<thizanne> but I had almost exactly the same problem in C and reading and writing byte-per-byte was the solution to avoid taking care of endianness
<thelema_> I guess I could do it in the makefile... hmm, maybe I should just look at ocaml's configure to see how it detects endianness. Probably by compiling and running a c program... hmm
<ousado> oh, that's C ..
<thelema_> yup, the ocaml configure script builds and runs a c program to detect endianness
Submarine has quit [Quit: Leaving]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
ika has joined #ocaml
thomasga has quit [Read error: Connection reset by peer]
ika is now known as Guest4258
Cyanure has quit [Remote host closed the connection]
metadave has quit [Remote host closed the connection]
Cyanure has joined #ocaml
alexandrus has joined #ocaml
milosn has joined #ocaml
mcclurmc is now known as mcclurmc_away
Submarine has quit [Ping timeout: 240 seconds]
Progster has quit [Ping timeout: 244 seconds]
pangoafk is now known as pango
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
silver has quit [Remote host closed the connection]
Yoric has joined #ocaml
xcombelle has quit [Quit: I am a manual virus, please copy me to your quit message.]
alexandrus has left #ocaml []
Progster has joined #ocaml
Yoric has quit [Ping timeout: 272 seconds]
georg has quit [Ping timeout: 245 seconds]
<ssbr-> Is there a nicer way to write this? http://bpaste.net/show/qlpamhrFPbmaTNYreCOp/
<ssbr-> it seems to come up a lot.
<adrien> which is?
<ssbr-> adrien: I don't really like writing folds like this
<thelema_> ... List.partition will leave the A's in one list and the B's in the other
<adrien> List.partition?
<thelema_> but it won't strip off the tags
<adrien> yup but without context, it's a very good solution
<adrien> if we had context...
<adrien> heat is awful in Paris, completely hammers you
<ssbr-> adrien: I literally copy pasted my code. Renamed "containment_checks" to "as", "is_checks" to "bs", "conts" to "alist", "ises" to "blist", "StmtIn" to "A", "StmtIs" to B, and "compiled.setops" to "stuff"
<ssbr-> adrien: more context might be that I plan on adding StmtLt and StmtLte
<ssbr-> (and partition into 4 lists)
<adrien> well, how do you come up with such a data structure?
<thelema_> order doesn't seem to be important, you just want a partition-by-tag function?
<ssbr-> adrien: not entirely sure
<thelema_> I don't see a good way to generalize this; the types don't work out.
<ssbr-> thelema_: I dunno, a for loop could be nice
<ssbr-> but that's all folds are in the end I guess
<thelema_> if the tuple was homogenous in types, it might be possible to use Obj and build an array
<ssbr-> I don't know
<thelema_> you could write the recursion out yourself
<ssbr-> writing big folds with anonymous functions bothers me for irrational reasons probably
<thelema_> I wouldn't worry about big folds with anonymous functions.
<ssbr-> is my indentation fine?
<thelema_> it's fine.
<thelema_> you could also write (fun (al,bl) -> function | A a -> (a::al, bl) | B b -> (al, b::bl)
<ssbr-> thelema_: I've decided I don't like that style of coding. I personally get too confused when I don't see the number of arguments up front :(
<ssbr-> (partial evaluation also confuses me)
<ssbr-> these seem less irrational than my "nyeh folds!!!" reaction, which my conscious brain can override and say "they're just the same as the loop you want to write, dummy"
<thelema_> fair enough, except that this function can't be called anywhere else and is a fold, so has known number of arguments.
<thelema_> but I agree with the general principle
<ssbr-> I still have to look up the function signature of fold :(
<thelema_> Maybe I've gotten good at looking for "function" and adding an argument mentally
<ssbr-> thelema_: this is probably true
<ssbr-> like, I bet it's something you can learn. And definitely this wouldn't throw me off for very long at all
<thelema_> me too - never can remember whether it's the accumulator or the next value first, and it changes for lists, sets, etc.
<ssbr-> unless I was only skimming
<ssbr-> thelema_: it changes for lists versus sets?!
<thelema_> well, it's different for List.fold_left and fold_right
<thelema_> and sets uses the fold_right order
<thelema_> for its ".fold" (there's no left and right fold)
<mcstar> the indentation of the patterns are horrible
<mcstar> imho
<thelema_> you could move "match next with" to the next line
<ssbr-> mcstar: yeah I have no idea what to do with those.
<thelema_> but I like my code dense
<ssbr-> any time any pattern matching comes up, it's like, where do I put the bars? `\o/`
<mcstar> emacs indents them alright
<ssbr-> thelema_: how can it be called dense with that big chunk of horizontal whitespace :P
<ssbr-> it's so big it starts to count as vertical whitespace.
<ssbr-> ugh, okay, why is the order different for fold_left vs fold_right?
<mcstar> s [e1;e2;e3...] vs. [e1;e2;e3...] s
<ssbr-> just to reflect where s gets put in the call tree?
<mcstar> to reflect the direction you eat the list
<ssbr-> :(
<mcstar> what?
* mcstar rather wants a smiley face
<ssbr-> I've never used that hint at all, so it only hurts me
* ssbr- uses "fold-left eats from the left, fold-right is replacing the cons function"
<ssbr-> I wish I had something more symmetrical but, damn it, it works, okay
<thelema_> ssbr-: the bars go under the keyword 'match'
<hcarty> thelema_: Did the OCaml 4.00 brew work for you?
<thelema_> hcarty: yes, it worked great. I'm distracted from upgrading batteries
<thelema_> sadly my fixed for v2 beta didn't backport cleanly to 1.x
<hcarty> thelema_: Glad it worked, and please don't let me distract you further.
<thelema_> hcarty: no worries
Progster has quit [Read error: Operation timed out]
<mcstar> so
<mcstar> i had something that would have taken 25 hours
avsm has joined #ocaml
<mcstar> but thanks to fft, it took 0.6 seconds
<avsm> NaCl: nope, only happens on 10.8
Submarine has quit [Quit: Leaving]
<ssbr-> uggggh. There's a List.map2 but no Array.map2
<NaCl> avsm: ah, lame, sorry
* ssbr- uses to_list
<NaCl> I'm not going to get 10.8 here for a few weeks
<thelema_> use batteries
<thelema_> BatArray.map2
<ssbr-> thelema_: not my project
<thelema_> ssbr-: or just implement it yourself - it's like 5 lines
<ssbr-> besides which, the library I'm using is the one returning an array
<ssbr-> thelema_: 1 line!
<ssbr-> let array_map2 f a b = List.map2 f (Array.to_list a) (Array.to_list b)
<thelema_> actually 3 lines, including error checking:
<thelema_> let map2 f xs ys = let n = length xs in if length ys <> n then raise (Invalid_argument "Array.exists2"); Array.init n (fun i -> f xs.(i) ys.(i))
<ssbr-> ughhhh
<hcarty> ssbr-: I'm guessing that there is no Array.map2 in stdlib because there is Array.mapi
<ssbr-> hcarty: that's not a bad observation
<hcarty> What is a good name for the opposite of slurp? Where slurp reads the contents of a file into a string, and its opposite would write a string to a file, creating the file if necessary: val splat : ~filename:string -> string -> unit
<adrien> puke? :P
<mcstar> contraslurp
<ssbr-> spit?
<ssbr-> (you only puke if you slurp + swallow)
<mcstar> ah, deslurp
gnuvince has quit [Quit: Remember when men were men and regular expressions recognized regular languages?]
gnuvince has joined #ocaml
Progster has joined #ocaml
mcstar has quit [Quit: mcstar]
<thelema_> hcarty: dump
Cyanure has quit [Ping timeout: 240 seconds]
dsheets has joined #ocaml
eni has joined #ocaml
<hcarty> Thanks all
r126f has quit [Ping timeout: 246 seconds]
r126f has joined #ocaml
srcerer has joined #ocaml
Guest4258 has quit [Quit: Leaving]
avsm has quit [Remote host closed the connection]
_andre has quit [Quit: leaving]
mcclurmc_away is now known as mcclurmc
eni has quit [Ping timeout: 272 seconds]
eni has joined #ocaml
<ssbr-> my new favorite trick: (MyType, a, b) instead of MyType (a, b)
<ssbr-> yaaaay polymorphism over tuples
<ssbr-> s/MyType/MyConstructor/ blah
ftrvxmtrx has joined #ocaml
<orbitz> What does that do?
<ssbr-> orbitz: it lets me write this: fun (tag, b, c) -> (tag, foo b, bar c)
<orbitz> ah
<ssbr-> my inability to do this has bothered me in the past. I guess with the past situations it wasn't convenient to do this? Or I never thought of it?
smondet has quit [Ping timeout: 244 seconds]
smondet has joined #ocaml
sepp2k1 has quit [Read error: Connection reset by peer]
eni has quit [Ping timeout: 244 seconds]
<hcarty> ssbr-: Would type ('a, 'b) t = MyConstructor of ('a, 'b) work for you?
<ssbr-> hcarty: no, because I want to handle MyOtherConstructor too
ulfdoz has joined #ocaml
<ssbr-> so I'd have to do function MyConstructor (a, b) -> MyConstructor (foo a, bar b) | MyOtherConstructor (a, b) -> MyOtherConstructor (foo a, bar b)
<fasta> ssbr-: are you deconstructing a constructor in that pattern match there?
<ssbr-> fasta: and then putting it back, yeah.
<fasta> ssbr-: you cannot do that in Haskell, right?
<ssbr-> fasta: well, I can do everything I've done in ocaml in haskell
<ssbr-> I don't know if haskell has any extra features to make this awesome
<ssbr-> being polymorphic over constructors doesn't seem hard in theory though
<fasta> ssbr-: sure, in theory nothing is hard.
gnuvince has quit [Ping timeout: 264 seconds]
<ssbr-> fun (anyconstructor (a, b)) -> (anyconstructor (foo a, bar b))
<ssbr-> fasta: no, in theory lots of things are hard
<ssbr-> like the halting problem! easier in practice, that one is
<fasta> ssbr-: the halting problem doesn't even exist.
<fasta> Anyway, got to go.
<ssbr-> analogues do of sufficient hardness
<ssbr-> oh right
<ssbr-> I didn't even _try_ to type that
<ssbr-> "fun (constructor a) -> a" couldn't be typed in haskell or ocaml's type system
<hcarty> ssbr-: But you can head in that direction with GADTs if I understand the examples properly.
<hcarty> ssbr-: Or you can go down a different track with the universal type fun that has been thrown around - http://alaska-kamtchatka.blogspot.com/2012/07/existential-crisis.html
<ssbr-> hcarty: grk, ocaml seems to solve the second problem just fine
<ssbr-> a "heterogenous list of elements that can be operated on by an extensible conversion function" isn't heterogenous at all
<ssbr-> it's homogenous in that every such element can be operated on by the conversion function
<ssbr-> i.e. the method
<ssbr-> (hee hee.)
<ssbr-> of course nobody uses objects...
<ousado> oleg did for encoding GADTs
ulfdoz has quit [Ping timeout: 244 seconds]
ulfdoz has joined #ocaml
<hcarty> ssbr-: I think that comment was made somewhere in there
Sablier has quit [Ping timeout: 252 seconds]
Sablier has joined #ocaml
<hcarty> ssbr-: With the caveat that you can't get the original object back once you coerce the value into the list.
mcclurmc is now known as mcclurmc_away
<ssbr-> hcarty: good to know. I don't know enough about type theory to follow
<hcarty> ssbr-: The last paragraph has the bit on objects
ulfdoz has quit [Ping timeout: 250 seconds]
<ssbr-> hcarty: why aren't structural subtyping and duck typing considered the same thing, as far as objects go?
<ssbr-> I mean, or, why isn't structural subtyping called "statically typed duck typing"
<hcarty> ssbr-: I'm not sure. My guess would be that it's for the reason given in that paragraph. Duck typing doesn't lose type information, structural subtyping does.
<ssbr-> ack, I see, it's a term for the whole type system that enables this
ulfdoz has joined #ocaml
<hcarty> ssbr-: But I don't know if structural subtyping requires that loss of type information
<ssbr-> hcarty: I would imagine it doesn't.
<ssbr-> it's part of the static type system, so it shouldn't make demands of the runtime...
smondet has quit [Quit: Leaving]
<hcarty> If those are accurate, it could have something to do with how strict/consisten the requirements are applied
<ssbr-> right
<ssbr-> er
<ssbr-> hcarty: it looks to me like it's really just a runtime/compile-time nomenclature difference. I mean the way things are treated is still fundamentally different
<ssbr-> or, er, otherwise it looks as if structural subtyping implies duck typing
gnuvince has joined #ocaml
ontologiae has joined #ocaml
ski has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
Progster has quit [Ping timeout: 248 seconds]
ski has joined #ocaml
ski has quit [Ping timeout: 255 seconds]
ontologiae has quit [Ping timeout: 264 seconds]
ski has joined #ocaml