postalchris has quit [Read error: 110 (Connection timed out)]
pango has quit [Remote closed the connection]
Skal has quit [Remote closed the connection]
yondalf has joined #ocaml
danly has quit ["Leaving"]
menace has quit []
yondalf_ has joined #ocaml
yondalf has quit [Read error: 60 (Operation timed out)]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
sponge45 has joined #ocaml
yondalf_ has quit ["leaving"]
danly has joined #ocaml
pango_ has quit [Remote closed the connection]
mbishop has quit ["brb"]
pango_ has joined #ocaml
mbishop has joined #ocaml
iZZy`` has joined #ocaml
ikaros_ has quit [Read error: 110 (Connection timed out)]
|narofi| has joined #ocaml
joshcryer has joined #ocaml
shans has joined #ocaml
<shans>
is there a way to tell when a script is loaded directly, rather than from another script?
<shans>
I want to have some simple testing functions that don't get executed unless the module is run directly
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
|narofi| has quit []
ramkrsna has joined #ocaml
danly has quit ["Leaving"]
mbishop has left #ocaml []
Smerdyakov has quit ["Leaving"]
<Mr_Awesome>
shans: i dont think so
<Mr_Awesome>
just make another module that runs the testing functions and calls the module
ppsmimou has quit [orwell.freenode.net irc.freenode.net]
ppsmimou has joined #ocaml
shans_ has joined #ocaml
shans has quit [Read error: 110 (Connection timed out)]
dark_light has joined #ocaml
Mr_Awesome has quit ["and the Awesome Level drops"]
<dark_light>
i am with a odd problem with constructors: http://nopaste.tshw.de/1164087305e2e00/ , why an constructor of form X of int*int don't accept a int*int variable?
<dark_light>
like let y = 1, 2 in X y
<dark_light>
let a, b = 1, 2 in X (a, b) works, but.. :(
<jdev>
That's a known weirdness of OCaml, I believe.
<jdev>
You also can't match X (1,2) with X y -> ...
<dark_light>
i think a future version of ocaml may support it without breaking anything
pango_ has quit [Remote closed the connection]
<dark_light>
ps: microsoft is one of few members of caml consortium. and it has it's own ML language, F#, so a priori there are no reason for microsoft support ocaml. that makes me feel bad
<dark_light>
nearly all competitors that microsoft touches are turned in ashes :(
shans has joined #ocaml
<sponge45>
dark_light, that's indeed a weirdness of OCaml. You must be careful in the type definition: type t = X of int * int is different from type t' = X of (int * int)
pango_ has joined #ocaml
<dark_light>
what is this t' ?
<sponge45>
just a name
<dark_light>
ah
<dark_light>
the difference is in the ()
<sponge45>
Yes
<dark_light>
hmmm
<sponge45>
it makes it a tuple
<sponge45>
so X has one argument which is a tuple
<dark_light>
X of (int * int) accepts only one parameter?
<sponge45>
yes, (1, 2) is one parameter
<dark_light>
!! but, there are any difference in compile level?
<sponge45>
you can detach it using a match
<sponge45>
there are differences, yes
<sponge45>
not very interesting though
<dark_light>
sponge45, i can't get why X of int * int receives "two" parameters, it seems having no benefits
<dark_light>
because i can't make a "type closure" (?)
<sponge45>
There is no big benefit, except that it's slightly faster to access
<dark_light>
so X of (int * int) seems to be simply better than X of int * int
<dark_light>
Hmmmm
<dark_light>
faster because i don't have to store an array?
<sponge45>
the 2-args version is pretty much like a tuple, while the one-arg version is like a pointer to a tuple.
<dark_light>
hm..
<dark_light>
well, i like convenience :)
<sponge45>
Look at the manual in the C/OCaml interface section if you are not convinced.
<dark_light>
sponge45, hmmm.. time to learn this i think
<sponge45>
I think polymorphic variants always use tuples
<dark_light>
(but i have no reason to make C interface, ocaml seems just fine alone)
<sponge45>
no, but they explain how the data are structured
<dark_light>
Hmm
<dark_light>
well personally i would prefer if there are no two-parameter, i see no big reason.. just confusing
<sponge45>
at least the syntax is confusing. It has been fixed in the "revised syntax" that nobody uses. It uses "and" instead of "*" when there are several arguments.
<dark_light>
revised syntax?
<sponge45>
the one that comes with camlp4
<dark_light>
didn't heard of that, i really think ocaml needs a.. hmm.. interface revision (i don't bother the internals, at least for now)
<dark_light>
ah
<dark_light>
hmm..
<dark_light>
er. :)
<dark_light>
i would prefer, humnnm, maybe, in ocaml itself..
<sponge45>
technically camlp4 is a part of ocaml, but it's a delicate topic.
<dark_light>
hmm, well, i used it only one time, so it's like a.. optional but funny thing
shans_ has quit [Read error: 110 (Connection timed out)]
<dark_light>
s/funny/fun/
<sponge45>
writing syntax extensions is even more fun :-)
shans_ has joined #ocaml
<dark_light>
never did it, but i would like hmmm a macro in runtime :(
<sponge45>
you like the dark side of programming, don't you?
<dark_light>
there are a camlp4 that does postgresql calls, but only at compile time.. not dynamic calls
<dark_light>
sponge45, oh yes :-)
<dark_light>
i have no idea how the camlp4 would process a macro at runtime *and* mantain type safety, but i think it is possible..
<dark_light>
(i actually understand nothing of this)
<sponge45>
well, I don't know exactly what you mean by that. There are certainly ways to embed interpreted languages within OCaml programs, but it can easily become complicated.
<dark_light>
but i mean the macro being executed as native/actual/etc ocaml code
<dark_light>
like camlp4 does at compile level, but at runtime instead
shans has quit [Read error: 110 (Connection timed out)]
<dark_light>
a bit like, hmm, generating printf strings at runtime (with ^^ operator)
<dark_light>
ps: oops, ^^ doesn't accept generating format strings at runtime.. :( format_of_string isn't of type string -> format4 as i though o.o
<dark_light>
it is actually more format_of_format :)
<sponge45>
maybe you can look at Dynlink. But I have never used it and it's limited to bytecode.
<sponge45>
i have to go now, bye!
<dark_light>
bye!
sponge45 has quit ["zzzzzzzzzz"]
johnnowak has joined #ocaml
johnnowak has quit []
_velco has joined #ocaml
love-pingoo has joined #ocaml
velco has joined #ocaml
pango_ has quit [Success]
Skal has joined #ocaml
pango has joined #ocaml
_fab has joined #ocaml
pango has quit [Remote closed the connection]
pango_ has joined #ocaml
rashnu has joined #ocaml
slipstream-- has joined #ocaml
buluca is now known as mind2
mind2 is now known as buluca
slipstream has quit [Read error: 110 (Connection timed out)]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
yondalf has joined #ocaml
shans has joined #ocaml
shans__ has joined #ocaml
shans_ has quit [Read error: 110 (Connection timed out)]
shans_ has joined #ocaml
shans has quit [Read error: 110 (Connection timed out)]
yondalf has quit [Read error: 60 (Operation timed out)]
yondalf has joined #ocaml
shans__ has quit [Read error: 110 (Connection timed out)]
pauld has joined #ocaml
dark_light has quit [Remote closed the connection]