<julm>
komar_: I don't think that what you want is possible; camlp4 is a preprocessor: it acts before the code is actually run. what you possibly may have is an Ast of {Some "string"} but not the value {Some "string"}
<julm>
-possibly
<julm>
that said I don't know if you could access the Ast of {Some "string"} when you encounter {a} without building yourself a table of bindings..
<flux>
a function that would 'magically' make a copy of a stream non-destructively could be nice
<flux>
fortunately batteries (iirc) comes with a non-desctructive variant too, but I suppose it is a bit more cumbersome to use that
<flux>
I suppose the problem isn't really the same, as containers look the same as enumerations
<flux>
in ocaml, nothing looks the same as something else :)
<flux>
oh, apparently python doesn't have such a magical function, it was false information :)
youscef has joined #ocaml
schme has quit [Remote closed the connection]
rwmjones has quit [Read error: 113 (No route to host)]
schme has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
rwmjones has joined #ocaml
schme has quit [Read error: 113 (No route to host)]
_andre has joined #ocaml
_andre has quit ["leaving"]
_andre has joined #ocaml
Ched has quit [Read error: 113 (No route to host)]
Ched has joined #ocaml
ulfdoz has joined #ocaml
ikaros has joined #ocaml
<deavid>
what is the difference between ocamlc and ocamlopt commands? Is ocamlc calling ocamlopt to compile? are ocamlc executables slower that ocamlopt?
<thelema>
ocamlc compiles to bytecode
<flux>
and ocamlopt native binaries
<thelema>
ocamlopt compiles to native code
<flux>
thelema took my thunder about the byte code, so I needed to fill in the native code answer :P
<thelema>
yes, bytecode is usually slower
<thelema>
:P
<flux>
;)
bombshelter13_ has joined #ocaml
<kaustuv>
is there any instance where bytcode is faster?
<flux>
well, native code cannot use green threads
<flux>
so perhaps very thread heavy code can be faster in byte code?
<thelema>
probably, but it'd be pretty contrived
<deavid>
and I suposse that, it's possible to compile anything into native code; I tried to compile one example that is using graphics library, but it gave me a error, complaining about the library (it seems that it recieves diferent arguments than ocamlc)
<kaustuv>
what is the exact command you used and error message from ocamlc/ocamlopt?
<deavid>
warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
<julm>
but I have an executable
<deavid>
that isn't good :P
<deavid>
ok, but probably that executable doesn't work in other systems... so you have lost the "cool thing" in static compilations
<kaustuv>
static linking is nearly always a stupid idea
<deavid>
probably :-)
<julm>
it sure is..
<deavid>
but a lot of windows programmers complaining about dll usually say that statically linked programs are better :D
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<deavid>
i have seen several "portable programs" and they usually are dynamically linked, but they come with the needed dll
<kaustuv>
I really doubt that's true, but even if it were, one shouldn't be looking to Windows for good taste.
<flux>
there was a related trick about that recently
<flux>
hmph, to my defence it's -R on solaris, but I doubt the $origin-trick works there :)
<kaustuv>
it's an undocumented hack and I hope the next version of gnu ld delibrately breaks $origin to make people come to their senses
<flux>
kaustuv, too useful?
<flux>
kaustuv, wrapper scripts with $LD_LIBRARY_PATH-magic are nicer?
itewsh has quit [Read error: 60 (Operation timed out)]
<kaustuv>
I don't know about nicer, but it is documented and portable.
itewsh has joined #ocaml
<flux>
hmm.. so one should a) provide a patch to gnu-people about documentation and b) provide a patch to opensolaris-people bringing in the support ;)
<kaustuv>
Why do you want shared libraries to reside in atypical locations?
<flux>
I personally don't, but I can see how nice it can be
<flux>
for example firefox comes with a set of libraries
<flux>
..and a wrapper script..
<flux>
and many commercial vendors do that
<flux>
possibly I'd like to distribute Goba with the dependency libraries too, so the binary would run in more platforms as-is ;)
<deavid>
kaustuv: because you can run the executable in-place; without having to control where is each library to know how to remove it; Thi is a issue that package managers like dpkg have resolved, but think about it when you want to test some app that isn't packaged
<deavid>
I find useful that, because you can try the app, and later, overwrite the libraries and executables by newer ones (from a newer compilation, for example), when you don't want that app, simply delete the folder
mpwd has joined #ocaml
<kaustuv>
I do it all the time with GNU stow and have yet to run into a single corner case.
<kaustuv>
I take that back. GODI doesn't play well with Stow. But it's the only exception I know of.
rjack has joined #ocaml
<deavid>
some apps can use only their own versions of well known libraries, this is a ugly hack, but anyway, for these apps I prefer to have the libs with it, and not install them system wide
shazam has joined #ocaml
<shazam>
hello, I've been using <:expr< `$uid:foo$ >> for my variant labels
shazam is now known as palomer
<palomer>
however, this is wrong (since labels can be lids too)
<flux>
kaustuv, hm, I've used it with stow.. what's the issue I should watch out for?
<kaustuv>
flux: I seem to recall that GODI really hates it when other programs try to install libraries to its path
<kaustuv>
flux: I have blissfully forgotten the details after I decided to ditch GODI for good
<hcarty>
kaustuv: What are you using in place of GODI?
<kaustuv>
hcarty: Debian's packages.
<hcarty>
kaustuv: Ah, of course :-)
kaustuv is now known as kaustuv_
ertai has joined #ocaml
<palomer>
how do you define a pattern for a polymorphic variant? something like <:patt< `$x$ >> (which doesn't work)
<hcarty>
palomer: The pa-do code may serve as a reference. It has some support for overloading polymorphic variants.
<hcarty>
palomer: It looks like they use <:expr:
<hcarty>
palomer: It looks like they use <:expr< `$s$ >>
<hcarty>
Sorry... sent that out too soon.
<hcarty>
palomer: src/delimited_overloading.ml in the pa-do sources
ulfdoz has quit ["deprecated"]
<palomer>
ahh, righto
<palomer>
ahh,righto, it _does_ work
<palomer>
neverimind
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
komar__ has joined #ocaml
komar_ has quit [Read error: 110 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
jado has joined #ocaml
<jado>
hi, i've tried the same command than the one to compile with the num library for compiling with Pcre but that does not work : http://paste.ubuntu.com/207010/
<jado>
does someone have an idea ?
<hcarty>
jado: Add "-linkpkg" to the command
<jado>
thanks
<hcarty>
jado: On newer versions of OCaml (3.11 and later, I think), you will get warnings and/or errors about using 81.ml as a file name.
<jado>
why does it need a letter ?
<jado>
prefer*
<hcarty>
Because 81 is not a valid module name.
<jado>
so it will also give warnings when there is no majuscule in the first letter ?
<hcarty>
The compiler used to accept most file names. But the file name defines the module name, so 81.ml would map to the module 81, which is not valid.
<Smerdyakov>
jado, what is a majuscule?
<Smerdyakov>
jado, and please remember that question marks are not preceded by spaces in English.
<jado>
Smerdyakov: sorry
<palomer>
majuscule = capitalized in french
<hcarty>
jado: No, it's not a direct mapping
<hcarty>
For example, foo.ml would map to the module Foo. myLib.ml would map to MyLib.
<hcarty>
palomer: Thanks for the clarification.
<jado>
ok i see
rjack has quit ["leaving"]
<jado>
thanks
<C_Tux>
Smerdyakov: hmm what ? :)
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<deavid>
there's any function that emulates the ocaml console? for example, say that function is named "out". I want to write "out myfunc" and get something like "myfunc : a' -> a'" in the console
<deavid>
like something to debug
<deavid>
im very new to ocaml and this will be helpful to start checking what is doing ocaml
<hcarty>
deavid: You can run "ocaml -i foo.ml" and it will display the inferred types for each value in foo.ml.
tautrimas has joined #ocaml
julm has quit [Read error: 60 (Operation timed out)]
tautrimas has quit [Client Quit]
tautrimas has joined #ocaml
youscef has left #ocaml []
<tautrimas>
Hello! I'm programming in OCaml for a month or so and I would like to do a networking project. Now the question: is it beneficial to use ocamlnet from the beggining or just go for plain sockets? I've never done anything with networking before
<palomer>
a lot of people are exploring ocaml this summer
tautrimas has quit [Read error: 104 (Connection reset by peer)]
tautrimas has joined #ocaml
<tautrimas>
I'm very sorry, but my computer has crashed and if somebody replied, please reply
<C_Tux>
tautrimas: ocamlnet's api is higer-level and is probably a better choice for bigger projects
<C_Tux>
what are you planning to do ?
<tautrimas>
try to develop a small distributed computing network
jado has quit [Read error: 104 (Connection reset by peer)]
<tautrimas>
well, if ocamlnet is a big thing, then I'll just stick with plain sockets. Thanks!
<C_Tux>
well, I guess there is no compelling reason for ocamlnet if you have control over all the computers
<tautrimas>
yes yes
<hcarty>
tautrimas: You might want to take a look at jocaml.
<tautrimas>
some time I already did
<tautrimas>
I just might want to drop an eye again
<hcarty>
There are also MPI and ocamlp3l.
<tautrimas>
for threading model I will try to program something like actors and will see if it works. Thank you for advice
Narrenschiff has quit []
zaemis has joined #ocaml
LeCamarade is now known as LeCamarade|Away
kig has joined #ocaml
jeanbon has quit [".)(.)(."]
ulfdoz has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
tautrimas has quit [Remote closed the connection]
mgodshal1 has joined #ocaml
rwmjones is now known as rwmjones_afk
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
gareth_ has joined #ocaml
<gareth_>
hi, are there standard libraries for unconnected, non-blocking udp in ocaml?
mgodshall has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit ["Ex-Chat"]
pants2 has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
pants1 has quit [Read error: 113 (No route to host)]
<deavid>
there's a way to load a program into the interpreter but without executing the code? for example, in haskell I could load files into ghci,
<mfp>
deavid: the code (let () = ...) will always be executed, as there might be side effects
<mrvn>
fun () -> ....
<mfp>
deavid: if you have no "toplevel phrases", though, #load "whatever.cmo" and ocaml whatever.cmo will both work
<mrvn>
Only thing you get out of it then though is that it syntax/type checks the code.
<deavid>
ah, ok, this is what i wanted :-D
<_andre>
#use "foo.ml";; works too i think
<deavid>
if i have toplevel phrases, they are executed, which is what i want
<deavid>
_andre: unbound value use :P
<mfp>
deavid: # #use "foo.ml"
<_andre>
deavid: did you type the # ?
<deavid>
haha
<mfp>
;;
<deavid>
ok, it worked
<_andre>
:)
<mfp>
if you have findlib, you probably want #use "findlib";; too (can be put in ~/.ocamlinit)
<deavid>
what is findlib?
itewsh has quit [Read error: 60 (Operation timed out)]
<mfp>
findlib/ocamlfind is a lib/tool to manage OCaml libs and ease compilation
itewsh has joined #ocaml
<mfp>
it allows to link against libs easily, e.g. ocamlfind ocamlopt -package extlib,uuidm,sqlite3 myprog.ml -o myprog -linkpkg
<mfp>
ocamlfind calls ocamlopt with the appropriate -I flags and links against the required .cmxa libs
<mfp>
you can also use it in the toplevel to load libs, by doing #require "package";;
<deavid>
ah, maybe later i'll try that;
<deavid>
There are examples of use of ocaml with sqllite3?
<deavid>
or with database registers...
<deavid>
I'm installing several packages related (mysql, postgresql, sqllite3 dependencies for ocaml) , but I don't know where i should search for the documentation
<mfp>
deavid: on Debian, you can find the HTML API docs on /usr/share/doc/libxxxx-ocaml-dev/html
<mfp>
normally the .mli are just as readable (and available everywhere)
<deavid>
mfp: interesting; there are equivalents for postgresql '
<deavid>
?
<Smerdyakov>
ORM = suck
<mfp>
deavid: no ORM AFAIK for PostgreSQL; there's http://merjis.com/developers/pgocaml, but it still requires SQL code (gives many static guarantees, though)
<deavid>
ok :-)
<maxote>
what about firebird?
<Smerdyakov>
deavid, what application are you working on?
<deavid>
Smerdyakov: none yet, I'm exploring the possibilities of the functional paradigm for database-oriented programs
<Smerdyakov>
And the SQL approach is independent of anything webby.
<deavid>
seems to be a language oriented for web , like php is
<Smerdyakov>
See my last line.
<deavid>
ok, i was on demos, and there aren't any of these, I'll take a look to the doc
<Smerdyakov>
Aren't any of whats?
<Smerdyakov>
I'm not claiming the current compiler is able to produce anything but web applications.
<Smerdyakov>
I'm talking about the language/library design ideas.
<Smerdyakov>
The SQL approach demonstrated there is IMO better than ORMs.
gareth_ has left #ocaml []
<deavid>
I can't consider that because I'm still learning about ORMs; The documentation related to Ur SQL seems very complex to understand
<Smerdyakov>
Yes, it's only for people who are comfortable with fancy type systems.
<deavid>
why do you think that mapping relational data to data objects sucks ?
<Smerdyakov>
Because working directly with SQL leads to simpler code.
<deavid>
but less automated
<deavid>
and that's why ORM are useful
<flux>
I think working with relations that would generate SQL would be the optimum
<flux>
it would handle the edge cases of different SQL syntax in backends, it would provide static (well, atleast some) guarantees, it would allow safely constructing queries from user input
komar__ has quit [Read error: 113 (No route to host)]
<deavid>
for me at least, it's not only a mater of generating SQL. It's a matter of describing the data like objects, where there are a layer that enforces how the data should be acceses and modified
<flux>
the last part is where pgocaml doesn't quite work, but otherwise it's pretty nice (well, it's option-type detection also sometimes triggers too eagerly)
<flux>
(uh, s/it's/its/2)
<flux>
deavid, the thing is that objects are best put into an object database. when all you have is objects, it becomes quite difficult to create performant queries with those interfaces.
<deavid>
ok, but which databases are object databases?
<flux>
dunno, there's a bunch; i've never used them :)
<deavid>
today I've read twice that, and I never knew about something like that
<Smerdyakov>
deavid, SQL programming in Ur/Web is more automated than traditional ORM programming.
<Smerdyakov>
In fact, traditional ORM can be implemented as a library entirely within Ur/Web, with static types guaranteeing that it's done right.
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<palomer>
what's an ORM?
<palomer>
oh, I see
<palomer>
you can embed SQL into Ur/Web in a type safe way?
<palomer>
what's the type system?
rwmjones_afk has quit [Remote closed the connection]
<Smerdyakov>
It's a new type system.
<Smerdyakov>
"The Ur type system"
<Smerdyakov>
Bird's-eye view is F omega plus type-level records with map.
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
Snark has quit ["Ex-Chat"]
lde has joined #ocaml
bombshelter13afk is now known as bombshelter13_
jeanbon has joined #ocaml
<palomer>
type-level records!
<palomer>
yeah, you can get SQL with that
<palomer>
is there something like "self" for records?
<flux>
for ocaml records you mean? no.
<palomer>
I'm doing {foo with bar = baz} where baz is an expression which contains instance variables of foo
<palomer>
let _ = { aaa = 8; bee = ignore aaa}; <--actually, this is a simpler example of what im trying to do
<flux>
ah, ok. well, you need to bind them to some other names prior constructing the record, then
<flux>
let _ = let aaa = 8 in { aaa = aaa; bee = ignore aaa }
<palomer>
type meow = {mutable aaa:int ; bee : unit -> unit }
<flux>
(maybe a shortcut similar to labeled arguments could be written in camlp4 ;-))
<palomer>
how would I do it with type meow?
<flux>
aaa isn't that different, really, the same thing works?
<palomer>
well, I want bee to do something different depending on a
<flux>
perhaps you can still find a better example then :)
schme has quit [Read error: 60 (Operation timed out)]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
<jonafan>
what happens if you need to cast up?
ulfdoz has quit [Read error: 60 (Operation timed out)]
<mfp>
jonafan: coerce to a derived class? you cannot do that, but you could as a method to the base class like method as_derived : derived option, returning Some obj if the coercion is possible, or None otherwise