<dmbaturin>
The module system point is probably not emhpasized enough, and (built-in) string support may look bleak compared to say python, but it still gives the right feel I think.
reem has quit [Remote host closed the connection]
reem has joined #ocaml
mengu has quit [Ping timeout: 264 seconds]
<sdegutis>
dmbaturin: thanks very much
<Drup>
you keep asking this question over and over =)
<Drup>
you should start to have an idea now, shouldn't you ? Now that you wrote small stuff in it
<sdegutis>
Drup: I did?
<Drup>
it was my impression
<sdegutis>
Drup: nevar
<sdegutis>
Drup: well, in my head, sure
<Drup>
if you didn't while talking all this time on the channel, I don't know what you are doing ^^'
<sdegutis>
Drup: I'd like to think I'm at the point in my career where I can research a language and read code in it without having to write it and still know the pros/cons of that language etc.
<sdegutis>
or whatever
<Drup>
If I may, apparently you aren't, since you are still asking question. If you were to write something in it in a small week, you would have your answers already.
<Drup>
Really just write something ... :p
<sdegutis>
Drup: I'm more interested in subjective opinions, they're much more valuable.
<sdegutis>
Drup: they form a much fuller picture about something and how it's used
<Drup>
sure, that's why you should forge your own
<dmbaturin>
There's a fable I read somewhere, about a figure carved from rock salt that saw the ocean the first time and was wondering what is it. The ocean told it to walk into it and find out, and when the salt man walked into it dissolved in it, it said "now I understand, the ocean is me".
<dmbaturin>
Or something like that. Read: try the damn language in real life finally. ;)
<Drup>
^
<sdegutis>
Drup: so far my opinion is "I would use OCaml instead of C/C++ if I had any reason to use those" but also "I kind of want to find a use for OCaml kind of"
<Drup>
just write something
<Drup>
for the sake of doing it
<sdegutis>
Got any ideas on what I could write in an hour?
<sdegutis>
Maybe a small Lisp.
<Drup>
I mean, someone on the chanel did a cat clone
<dmbaturin>
Also, >I'd like to think I'm at the point in my career where I can research a language without having to write it and still know the pros/cons; Unless you have really strong understanding of programming language theory, I would refrain from statements like that. ;)
<Drup>
it's great, now with a cat in OCaml, it's perfectly fine :D
<dmbaturin>
I think I could say the same a couple of years ago.
<sdegutis>
ok i wrote let () = print_string "foo"
<Drup>
(especially when you start encounting languages that are really outside the classic paradigms)
<dmbaturin>
(Now I have vague understanding of how wrong I would be if I said that :)
<Drup>
(yeah sure, you can judge C-like languages very fast if you have used 2 of them ...)
<sdegutis>
Well, here's my understanding so far.
<sdegutis>
Even JavaScript can be awesome, the main three downsides of this specific language being (1) the caveats you have to avoid, like 'this', (2) the verbosity, and (3) dynamic typing.
<sdegutis>
Static typing is super helpful for rapid development since it short circuits the error-catching cycle. Destructuring (pattern matching) can help a ton to cut down on verboseness.
<sdegutis>
But overall, any language with first-class functions can be used just like OCaml can. The main benefit of OCaml is speed and static typing.
<sdegutis>
And all the special features of OCaml are basically there to make sure you still get the awesomeness while keeping static typing.
<sdegutis>
Sound right?
<dmbaturin>
The point when I got how wrong I was was when I learned that properties of type system such as soundness can be and are being proved.
<ousado>
not actually, no
<sdegutis>
?
<Drup>
sdegutis: you forgot a good amount of things
<Drup>
and type systems usually show really their worth at medium to large scale. In particular when refactoring
<dmbaturin>
This was also what turned me to PLT.
<sdegutis>
Drup: I would /love/ a static type system at work, where we use Clojure and catch most of our bugs with a horrid test suite
<sdegutis>
Drup: so yes I agree
<sdegutis>
Drup: what did I forget btw?
<sdegutis>
ousado: oh?
<Drup>
the module system is a big thing you forgot
<ousado>
you didn't say a word about ADTs
<dmbaturin>
Also, note that pattern matching not only removes verboseness. It also catches missed cases automatically (the check is not complete, but apparently sound).
<ousado>
which, fankly, makes me think you're missing the point more or less completely
<sdegutis>
ousado: ADTs are super useful for glue-code, like Either or Result etc
<ousado>
*frankly
<sdegutis>
ousado: I imagine they're also useful for extremely large code that's relatively isolated from external formats
<dmbaturin>
Or for internal representations of external formats. Look at XML parsers.
<dmbaturin>
Or finite sets of e.g. states.
<ousado>
I don't know what to answer.. I'd recommend to start 1) reading 2) using ocaml
<Drup>
dmbaturin: the check is not complete ?
<dmbaturin>
Drup: Well, there are cases that it fails to recognize as exhaustive. Complete as in Goedel.
swgillespie has quit [Ping timeout: 272 seconds]
<Drup>
are you sure ? it seems to me it is for OCaml
<ousado>
dmbaturin: you're talking about guards?
<Drup>
oh, I see where you are going
<Drup>
yes, you are right
MooseAndCaml has quit [Ping timeout: 246 seconds]
<dmbaturin>
ousado: Yes, but I think I did hit a case when I got a warning for non-guarded patterns. I'll withdraw my statement about non-guarded patterns until I reproduce it though. :)
<Drup>
if you do nested matches, the ocaml typechecker will not propagate the information properly and affirm that matches are incomplete when they aren't
<dmbaturin>
In any case, soundsness is more important than completeness.
<andlarry>
and am getting the following error when trying to define the log_entry function:
<andlarry>
"Error: This expression has type zone:Core.Zone.t -> bytes but an expression was expected of type bytes"
<andlarry>
I assume this is related to the recent change toward immutable strings (I'm using OCaml 4.02.1) but am super new to OCaml and don't know how I would work around it.
<andlarry>
Here's the function definition, so you don't have to go to the site
<andlarry>
let log_entry maybe_time message =
<andlarry>
let time =
<andlarry>
match maybe_time with
<andlarry>
| Some x -> x
<andlarry>
| None -> Time.now ()
<andlarry>
in
<andlarry>
Time.to_sec_string time ^ " -- " ^ message
<andlarry>
It took me a long time to realize to_sec_string returned a function
struk|desk has joined #ocaml
badkins has quit []
struktured has quit [Ping timeout: 265 seconds]
<dmbaturin>
andlarry: Well, that's why I said a missed argument is the most likely cause. It said the type is "Whatever.t -> bytes" where bytes was expected.
reem has joined #ocaml
<andlarry>
thanks, yeah I didn't understand. All the OCaml I've been exposed to is up to the "Options" section of the first chapter of real world ocaml.
<andlarry>
I finally found a usage in the unit tests that helped me understand
<sdegutis>
Drup: it is nice when True/False are defined as an ADT
<sdegutis>
Drup: granted, some people have complained about that, because somehow boolean lacks context that a more complex type could have provided
<sdegutis>
or something
<sdegutis>
I remember hearing this from #haskell, that's all.
<dmbaturin>
andlarry: Also, typing a function name in the repl gives you its type.
<dmbaturin>
utop # List.nth ;;
<dmbaturin>
- : 'a list -> int -> 'a = <fun>
<dmbaturin>
Arrow types also appear in signatures, as in "('a -> bool) -> 'a list -> bool" for List.exists, so for higher-order functions you also know what kind of function it expects.
testcocoon has quit [Ping timeout: 246 seconds]
<dmbaturin>
So once you are used to ocaml types, this error ceases to be odd. :)
<andlarry>
nice, thanks
<andlarry>
I created a pull request with the fix, let's see if it gets merged
reem has quit [Remote host closed the connection]
testcocoon has joined #ocaml
reem has joined #ocaml
Algebr has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
hilquias has joined #ocaml
reem has joined #ocaml
ggole has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
reem has quit [Remote host closed the connection]
reem has joined #ocaml
Intensity has quit [Remote host closed the connection]
reem has quit [Remote host closed the connection]
swgillespie has joined #ocaml
swgillespie has quit [Client Quit]
swgillespie has joined #ocaml
antkong_ has joined #ocaml
andlarry has quit [Ping timeout: 246 seconds]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
huza has joined #ocaml
reem has joined #ocaml
diethyl has quit [Ping timeout: 264 seconds]
sivoais has quit [Ping timeout: 265 seconds]
reem has quit [Remote host closed the connection]
swgillespie has joined #ocaml
antkong_ has quit [Ping timeout: 246 seconds]
diethyl has joined #ocaml
reem has joined #ocaml
sivoais has joined #ocaml
reem has quit [Remote host closed the connection]
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ivan\ has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
moei has quit [Read error: Connection reset by peer]
moei has joined #ocaml
ivan\ has joined #ocaml
reem has quit [Remote host closed the connection]
Guest67128 has joined #ocaml
Guest67128 has quit [Remote host closed the connection]
apple_ has joined #ocaml
reem has joined #ocaml
apple_ has quit [Client Quit]
_pakchoi_ops has joined #ocaml
Kakadu has joined #ocaml
AlexRussia has quit [Ping timeout: 264 seconds]
reem has quit [Remote host closed the connection]
willy_ has joined #ocaml
AlexRussia has joined #ocaml
reem has joined #ocaml
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Simn has joined #ocaml
thorsten` has quit [Ping timeout: 246 seconds]
segmond has quit [Ping timeout: 252 seconds]
huza has quit [Quit: WeeChat 0.3.8]
AlexRussia has quit [Ping timeout: 245 seconds]
mort___ has joined #ocaml
segmond has joined #ocaml
mort___ has quit [Quit: Leaving.]
slash^ has joined #ocaml
mort___ has joined #ocaml
hilquias has quit [Ping timeout: 264 seconds]
MercurialAlchemi has joined #ocaml
thorsten` has joined #ocaml
mort___ has quit [Quit: Leaving.]
Ansnum has joined #ocaml
reem has quit [Remote host closed the connection]
Submarine has joined #ocaml
Submarine has joined #ocaml
tnguyen has joined #ocaml
tnguyen has quit [Client Quit]
Ansnum has quit [Quit: Ansnum]
Guest90013 has joined #ocaml
reem has joined #ocaml
tane has joined #ocaml
Guest90013 has quit [Ping timeout: 252 seconds]
ygrek has joined #ocaml
AlexRussia has joined #ocaml
reem has quit [Remote host closed the connection]
oscar_toro has quit [Ping timeout: 245 seconds]
MercurialAlchemi has quit [Ping timeout: 255 seconds]
ygrek has quit [Ping timeout: 264 seconds]
rgrinberg has quit [Quit: Leaving.]
oscar_toro has joined #ocaml
Ansnum has joined #ocaml
ebzzry has quit [Read error: Connection reset by peer]
willy_ has quit [Quit: Leaving]
_pakchoi_ops has quit [Read error: Connection reset by peer]
antkong has joined #ocaml
_pakchoi_ops has joined #ocaml
laughing-octo-sh has joined #ocaml
antkong has quit [Ping timeout: 255 seconds]
yomimono has joined #ocaml
segmond has quit [Ping timeout: 252 seconds]
yomimono has quit [Ping timeout: 240 seconds]
segmond has joined #ocaml
yomimono has joined #ocaml
mort___ has joined #ocaml
antkong has joined #ocaml
ygrek has joined #ocaml
<destrius>
do backtraces not work in utop, or am i doing something wrong? whenever i call Exn.backtrace(), i get something about stack.ml, called from unknown location.
Haudegen has quit [Ping timeout: 256 seconds]
mort___ has quit [Quit: Leaving.]
MercurialAlchemi has joined #ocaml
Haudegen has joined #ocaml
antkong has quit [Quit: antkong]
monod has joined #ocaml
lordkryss has joined #ocaml
<ggole>
They don't work, unless something changed recently
larhat has joined #ocaml
dav has quit [Ping timeout: 256 seconds]
dav has joined #ocaml
rks` has quit [Quit: Lost terminal]
trefis has joined #ocaml
<destrius>
ok thanks
reem has joined #ocaml
trefis is now known as rks`
reem has quit [Ping timeout: 245 seconds]
Anarchos has joined #ocaml
monod has quit [Quit: Sto andando via]
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
Anarchos has joined #ocaml
dav_ has joined #ocaml
dav has quit [Ping timeout: 252 seconds]
seliopou has quit [Ping timeout: 245 seconds]
ygrek has quit [Ping timeout: 246 seconds]
dav_ has quit [Ping timeout: 255 seconds]
dav has joined #ocaml
vbmithr has quit [Ping timeout: 245 seconds]
seliopou has joined #ocaml
vbmithr has joined #ocaml
ned- has quit [Ping timeout: 244 seconds]
rossberg has quit [Ping timeout: 265 seconds]
ebzzry has joined #ocaml
rossberg has joined #ocaml
Nahra has joined #ocaml
dbp has quit [Ping timeout: 255 seconds]
<whitequark>
destrius: I actually wrote a patch to add backtraces to toplevel
<whitequark>
def`: well they did! I based my patch off someone's patch for 3.11
<whitequark>
though there's nothing left of it
Haudegen has quit [Ping timeout: 265 seconds]
ned- has joined #ocaml
Haudegen has joined #ocaml
Algebr has quit [Ping timeout: 272 seconds]
dav_ is now known as dav
jbrown has quit [Remote host closed the connection]
Algebr has joined #ocaml
mort___ has joined #ocaml
dbp has quit [Ping timeout: 255 seconds]
awegwaegaweg has joined #ocaml
matason has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
Anarchos has joined #ocaml
hilquias` has joined #ocaml
hilquias has quit [Ping timeout: 246 seconds]
carm has joined #ocaml
struk|desk has quit [Ping timeout: 265 seconds]
struktured has quit [Ping timeout: 265 seconds]
carm has quit [Read error: Connection reset by peer]
carm has joined #ocaml
awegwaegaweg has quit [Ping timeout: 246 seconds]
Submarine_ has joined #ocaml
matason has quit [Ping timeout: 256 seconds]
bytbox has quit [Remote host closed the connection]
seangrove has quit [Remote host closed the connection]
seangrove has joined #ocaml
Haudegen has quit [Ping timeout: 246 seconds]
dav_ has joined #ocaml
Haudegen has joined #ocaml
dav has quit [Ping timeout: 264 seconds]
shinnya has quit [Ping timeout: 265 seconds]
<Drup>
whitequark: did you found a solution for deriving and phantom types ?
<whitequark>
what was the issue?
<Drup>
well, you have a type with a type parameter but the deriver should not take a parameter
<Drup>
[%deriving.show 'a foo] will not work, will it ?
<whitequark>
[%deriving.show: _ foo]
<Drup>
oh, that works ?
<whitequark>
yes
<Drup>
ok, nevermind then :D
<Drup>
(I don't see documentation for it, though)
dbp has joined #ocaml
Submarine_ has quit [Remote host closed the connection]
Submarine has quit [Remote host closed the connection]
BitPuffin has quit [Ping timeout: 244 seconds]
bytbox has joined #ocaml
mort___ has quit [Quit: Leaving.]
yomimono has quit [Ping timeout: 256 seconds]
AlexRussia has quit [Ping timeout: 250 seconds]
MrScout has joined #ocaml
MrScout has quit [Remote host closed the connection]
MrScout has joined #ocaml
rgrinberg has joined #ocaml
MrScout has quit [Remote host closed the connection]
Haudegen has quit [Ping timeout: 256 seconds]
Haudegen has joined #ocaml
BitPuffin has joined #ocaml
A1977494 has joined #ocaml
AlexRussia has joined #ocaml
Anarchos has quit [Quit: reboot haiku...]
<Drup>
rgrinberg: how is the ocsigenserver investigation going ?
matason has joined #ocaml
<dmbaturin>
In a multiway tree, I want to be able to insert before or after specific child (the order is important in some cases). Is it a good idea to make type 'a position = None | Before of 'a | After of 'a and pass it as an argument to insert?
<dmbaturin>
s/None/Dont_care/
<Drup>
it's not a bad idea, but if you have O(n) find, it's quite terribad
<dmbaturin>
It bothers me too.
<dmbaturin>
The only good thing is that order doesn't always matter and in most cases I can just cons.
<dmbaturin>
The other good thing is that I hardly can make it worse than it is now. In the current version that tree is mapped to a _directory tree_ and node lookups are directory lookups. I'm not kidding.
<mbac>
so, you're re-arranging deck chairs on the titanic worrying about this
<dmbaturin>
mbac: No, I'm rewriting that thing from scratch.
<mbac>
oh
<dmbaturin>
Right now it's a mix of C++ and perl, and instead of using in-memory datastructures it stores internal data as a directory tree with values in files.
<Drup>
(did you wrote this thing ? :D)
<dmbaturin>
The original one? No, it was written before I even started with that project.
slash^ has quit [Read error: Connection reset by peer]
bjorkintosh has quit [Ping timeout: 244 seconds]
martintrojer has joined #ocaml
<companion_cube>
rgrinberg: o/
dav__ has joined #ocaml
reem has joined #ocaml
dav_ has quit [Ping timeout: 255 seconds]
psy has quit [Read error: Connection reset by peer]
manud has quit [Quit: manud]
psy has joined #ocaml
manud has joined #ocaml
rgrinberg has quit [Quit: Leaving.]
rgrinberg has joined #ocaml
<haesbaert>
given tuples t1 = (1,2,3), t2 = (5,6,7), how to I get a tuple which is the sum of the positional arguments: (6,8,10) ?
<haesbaert>
as in, what is the more common idiom for that ?
<Drup>
let f (a1,b1,c1) (a2,b2,c2) = (a1+a2,b1+b2,c1+c2)
<Drup>
(alternatively, BatTuple.Tuple3.mapn (+)
<haesbaert>
that will do, I was thinking if there was a tuple map
<haesbaert>
no need, that should do
yomimono has joined #ocaml
The_Mad_Pirate has quit [Quit: Konversation terminated!]
larhat has quit [Quit: Leaving.]
rgrinberg has quit [Quit: Leaving.]
matason has quit [Ping timeout: 264 seconds]
Jefffrey has joined #ocaml
tnguyen has joined #ocaml
swgillespie has joined #ocaml
rgrinberg has joined #ocaml
vivien_ has joined #ocaml
reem has quit [Remote host closed the connection]
<vivien_>
Hello, my problem is I want to compile some ocaml code with wine. I have no problem running "ocamlc -c foo.ml -o foo.cmo" but I wanted to use the OASIS build system, which doesn't work properly on Wine : it adds single quotes everywhere, and the file names are not recognized. What should I do ?
waneck_ has joined #ocaml
tnguyen has quit [Quit: tnguyen]
<nicoo>
dmbaturin: What does the thing you are replacing *do* ?
<nicoo>
adrien: You should try rust, the whole ecosystem is still fairly hip and cool
<adrien>
they're readying 1.0
<adrien>
that won't last
<Algebr>
is ; a camp4o extension or actually part of the ocaml spec?
<Drup>
why would ";" be a camlp4o thing o_o
<dmbaturin>
vivien_: On wine? Why would you run it on wine?
Anarchos has joined #ocaml
waneck has quit [Ping timeout: 252 seconds]
reem has joined #ocaml
<dmbaturin>
Or you are compiling windows binaries on UNIX with windows version of the compiler running on wine?
<vivien_>
It seemed simplier to compile for windows via wine ocamlc.exe
<vivien_>
yes
waneck has joined #ocaml
waneck_ has quit [Read error: No route to host]
<Drup>
I doubt it is :D
tane has quit [Quit: Verlassend]
<dmbaturin>
nicoo: The complete project is a linux distro for routers. It maintains a single system config from which configs for quagga, iptables etc. are generated by a bunch of scripts. So the user gets a CLI like those of juniper etc. and the rest is seemless for them. The thing in question handles config change requests and runs those scripts when user commits changes.
<Algebr>
Drup: because camlp always gives annoying preprocessor messages when I forget or add a ; accidentally.
<vivien_>
So, what should I do to compile something for Windows ?
<Drup>
pray adrien.
<nicoo>
dmbaturin: Sounds like pfSense, but without the web UI and the XML+PHP init
<adrien>
Drup: well, the current stuff on windows works
<Drup>
adrien; not the cross compilation
<dmbaturin>
nicoo: Unlike in pfSense, you can make multiple changes in different places and commit at once, or compare config revisions, or rollback to previous revisions. But the internals are quite awful.
<adrien>
Drup: but you can still get your stuff built without too much hassle
<Drup>
if you say so :p
<dmbaturin>
Does OASIS work on windows with cygwin?
<Drup>
yes
<adrien>
(and without too)
ghostpl_ has quit [Read error: Connection reset by peer]
<haesbaert>
can I make a funtction with a single optional argument ?
ghostpl__ has joined #ocaml
<haesbaert>
I seem to be failing
<dmbaturin>
I think you can't.
<adrien>
# let f ?a = ();;
<adrien>
Warning 16: this optional argument cannot be erased.
<Drup>
haesbaert: add a unit argument
<adrien>
as the warning says :)
<Drup>
(at the end)
<haesbaert>
how do I do that ?
testcocoon has quit [Quit: Coyote finally caught me]
<haesbaert>
OHHHH
<haesbaert>
got it :D
TheCommieDuck has joined #ocaml
* haesbaert
just found out optional arguments can't be the last one also
<nicoo>
dmbaturin: Don't worry, pfSense's internals are probably worse.
* nicoo
isn't exactly fond of pfSense
* haesbaert
hacks pf for a living
<nicoo>
haesbaert: Oh, you work on PF ? :)
<haesbaert>
sadly yes
yminsky has joined #ocaml
testcocoon has joined #ocaml
<dmbaturin>
nicoo: Well, I know. It's not an excuse for us not to improve it though. :)
<nicoo>
darnuria: Yup. The UI looks good, though
<nicoo>
haesbaert: Why “sadly” ?
<haesbaert>
I think the code is bad
<dmbaturin>
One of the problems is that only config read API can be exposed in a sane way, but config writes rely on shell hacks. Another problem is that commit is not fully atomic.
<haesbaert>
the great thing about pf is the syntax
laughing-octo-sh has quit [Ping timeout: 245 seconds]
reem has quit [Remote host closed the connection]
reem has joined #ocaml
<nicoo>
haesbaert: Yes
<haesbaert>
but to be fair, pf pays the price of other badly structured subsystems, especially the routing table
<haesbaert>
(in openbsd)
bytbox has joined #ocaml
Jefffrey has quit [Remote host closed the connection]
Kakadu has quit [Remote host closed the connection]
<haesbaert>
how do I figure out which exceptions open_in can raise ?
<haesbaert>
documentation doesn't say any, but obviously a file not found is one of them
<haesbaert>
for instance: wc: internal error, uncaught exception: Sys_error("/tmp/dkjsaldasdsadas: No such file or directory")
<haesbaert>
how do I catch that with the error messag e?
<adrien>
actually the doc says:
<adrien>
=== Input/output Note: all input/output functions can raise Sys_error
<adrien>
when the system calls they invoke fail. ===
<adrien>
but it's not easy to see it at all
<haesbaert>
arghh, sorry, I just read the open_in and failed to look at the rest
<adrien>
I wasn't aware this was there until today
<haesbaert>
how can I catch the error of Sys_error ?
<haesbaert>
the message I mean
<haesbaert>
with Sys_Error as e ?
<adrien>
try ... with Sys_error s -> print_endline s