<Riastradh>
What part of 'classes aren't first-class' don't you understand?
<LittleDan>
Could you rephrase it?
<LittleDan>
Do you mean not everything is part of the object system?
<Riastradh>
There isn't enough in that sentence to make a different phrase from it.
<LittleDan>
Classes are lower than types?
<mattam_>
equal
mattam_ is now known as mattam
<Riastradh>
No...classes are not first-class. I didn't say anything about types.
<LittleDan>
mattam_: That's what I though
<LittleDan>
t
<Banana>
LittleDan: classes are not values.
<mattam>
it means classes cannot manipulated by the language as values
<LittleDan>
oh
<mattam>
cannot be manipulated
<Banana>
objects are values, classes are on another level, like modules or type.
<LittleDan>
Why did they make it like that?
<Banana>
because it is how it has to be.
<Banana>
what would be the type of your "new" function ?
<LittleDan>
why?
<Demitar>
LittleDan, class | object is the same distinction as type | value.
<mattam>
because otherwise you need a richer type system that needs runtime type information.
<LittleDan>
Is there any reason for not having runtime type information besides performance?
<mattam>
ocaml is about having a powerful static type system (and it is very good at it) and no type information at the runtime.
<Smerdyakov>
Simplicity in the language design
<Banana>
LittleDan: soundness.
<mattam>
besides performance, there are probably type-checking issues
<Banana>
but thinking of it if classes were values, then types would also be.
<mattam>
the question you should answer now is why you need that LittleDan
<Demitar>
The strong static rich typing allows me to write sloppy code and get away with it so don't go and change that. :)
<LittleDan>
mattam: I was just wondering. In other languages I sometimes pass around classes as variables.
<Demitar>
LittleDan, do you have an example?
<Banana>
which languages ?
<Nutssh>
Runtime type information means that the compiler cannot check as much at compile time.
<Demitar>
An example of a language which isn't entirely dynamically typed preferably. :)
<LittleDan>
Demitar: OCaml is the only statically typed language I know besides C
<mattam>
python :)
como has quit [Client Quit]
<LittleDan>
mattam: That's dynamically typed
<mattam>
i was answering Banana's question.
<Demitar>
LittleDan, well dynamically typed languages can naturally pass classes about, or are there some who can't (it wouldn't be impossible naturally but a bit limiting)?
<mattam>
python is very nice for its liberal type system, and awful for having literally no static checks, except indentation ;)
<LittleDan>
Demitar: There are all of the non-OO dynamically typed languages
<Banana>
typechecking done in the lexer, nice indeed.
<mattam>
hehe
<mattam>
a hack!
<Demitar>
LittleDan, aww, you caught me off-guard on that one. ;-)
<Banana>
LittleDan: do you need to build a class at runtime ?
* mattam
got his little psql & mysql wrapper wrote, going to watch a film to forget about SQHELL.
<LittleDan>
Banana: Sometimes, yes. In Python, it's often useful to use objects like c structures.
Nutssh has left #ocaml []
<LittleDan>
Banana: Of course in OCaml, I'd just use a record
brad-b has joined #ocaml
<Banana>
you have to declare a type before using a record.
<Banana>
you can't build them at runtime.
<LittleDan>
Banana: I know, but that's what I'd do instead, even if it's not exactly the same
<Banana>
i don't really understand... maybe it's too late.
<Demitar>
It's not possible to use chained dbm databases in ocaml?
<Demitar>
That is one entry contains another database.
<LittleDan>
Banana: For certain purposes, I'd use objects with variables declared at runtime in Python or I'd use records in OCaml
<Banana>
ok.
brad-b has left #ocaml []
<LittleDan>
does < a : 'a; .. > -> 'a refer to a function that takes an object which has an attribute a of any type and returns something of the same type?
<Riastradh>
s/attribute/method/1, yes.
jesse_ has quit [Read error: 60 (Operation timed out)]
<LittleDan>
Riastradh: (what does 1 mean at the end of a regex?)
<Banana>
Demitar: you mean with the Dbm module ?
<Demitar>
Banana, that was what I was thinking primarily, or should I google for another?
<Banana>
can't you store just the name of the db ?
<Demitar>
Banana, I'd have to encode the path somehow but yes, that has passed my mind.
<Demitar>
The real question is how to serialize the datastructure I guess.
<Demitar>
Then again, that's the simple part now that I come to think of it.
slashvar has joined #ocaml
LittleDan has left #ocaml []
<slashvar>
Yop
<Banana>
yo slashvar.
<Banana>
Demitar: you want to put the inner DB in th same file as the container one ?
<Demitar>
Banana, that was the original thought, but I've discarded that now.
<Demitar>
Still I need to encode the data naturally.
<Banana>
time to go to bed...
<Banana>
good night.
Banana is now known as Banana[AFK]
Kinners has left #ocaml []
slashvar has quit ["sleeping time"]
lam has quit [Remote closed the connection]
lam has joined #ocaml
async has quit [Client Quit]
wazze has quit ["Learning about how the end letters on French words are just becoming more and more silent, I conclude that one day the French]
buggs^z has joined #ocaml
buggs has quit [Connection timed out]
Kinners has joined #ocaml
sproctor_ has joined #ocaml
sproctor has quit [Read error: 113 (No route to host)]
Kinners has left #ocaml []
smklsmkl has joined #ocaml
sproctor_ has quit [Read error: 60 (Operation timed out)]
smkl has quit [Read error: 110 (Connection timed out)]
skylan has joined #ocaml
__DL__ has joined #ocaml
__DL__ has quit [Client Quit]
karryall has quit ["."]
Nutssh has joined #ocaml
buggs^z is now known as buggs
smklsmkl is now known as smkl
lam has quit ["Lost terminal"]
lam has joined #ocaml
karryall has joined #ocaml
Nutssh has quit ["Client exiting"]
rox has quit [calvino.freenode.net irc.freenode.net]
rox has joined #ocaml
Nutssh has joined #ocaml
Banana[AFK] is now known as Banana
pattern has quit [Read error: 104 (Connection reset by peer)]
tomasso has joined #ocaml
wazze has joined #ocaml
<karryall>
is caml-list down ? no messages since last wednesday ... that's unusual
jesse_ has joined #ocaml
Nutssh has quit [Read error: 60 (Operation timed out)]
brad-b has joined #ocaml
CosmicRay has joined #ocaml
<CosmicRay>
hello. I'm wondering if there is any sort of database abstraction layer for ocaml, similar to JDBC, DBI, or DB-API?
<Hadaka>
CosmicRay: you can use perl DBI with ocaml - that's probably the most common thing
<Smerdyakov>
I have heard there is an ODBC interface.
<CosmicRay>
Hadaka: that sounds incredibly evil :-)
<CosmicRay>
Hadaka: can you elaborate a bit? OCaml has Perl bindings?
<CosmicRay>
the "humps" link to ocamlodbc appears broken
<karryall>
it should be on maxence site somewhere ...
phj has joined #ocaml
<phj>
How to use "Pattern matching of a parameter" ? please give some example .
<Smerdyakov>
Example: Read the OCaml tutorial. :P
<phj>
I'm reading it.
<phj>
whether can I define function f as the following ?
<phj>
let f = function
<phj>
| x -> 1
<phj>
|x,y -> x + y ;;
<Riastradh>
That x will match anything.
<Banana>
you can't do what i think you want to do :D
<Smerdyakov>
I think you may be confused about OCaml and static typing.
<Smerdyakov>
As Riastradh said, the first pattern matches anything, even a pair.
<Smerdyakov>
And you can't have a function that takes both pairs and something else as input, anyway.
<phj>
what I want to do is let function f with two different arguments,such as f x , f x y
<mellum>
phj: you can't
<phj>
is there any method to do that ?
<mellum>
Yes, have two differently named functions
<Hadaka>
phj: two different functions
<Hadaka>
phj: also look into optional arguments in labels, that might be what you want
<Hadaka>
but probably not, if you are *just* starting with ocaml
<phj>
yeah,I'm newbie to ocaml.
<Hadaka>
phj: so the correct answer is 'two different functions' for now - read more, learn more
gl has quit ["changing servers"]
<phj>
where can I found more tutorials document on ocaml except that of listed on ocaml home site?
gl has joined #ocaml
<gl>
phj: or make your own type: "type mine = Double of int * int | Single of int" then "let f = function Double(x,y)-> x+y | Single _ -> 1;"
<Smerdyakov>
Oh no.
<gl>
:)
<Smerdyakov>
Maybe that is too complicated for now, gl! :P
<mellum>
phj: we could maybe give better advise if you told us what you *really* want. What should f do?
<gl>
phj: then you could do this "f (Single 5))" or "f(Double(4,5))"
<gl>
too many parenthesis in my expressions ...
<mellum>
gl: seems much uglied than f_single 5; f_double 4 5
<mellum>
uglier even
<Hadaka>
phj: I would suggest you read the O'Reilly book - I consider it very good
<gl>
mellum I agree
<Hadaka>
phj: you can find a link to it from the caml pages
<mellum>
gl: then why do you suggest it? :)
<phj>
Hadaka: I downloaded it.
<gl>
mellum I thought he wanted only one function
<gl>
It's a (bad?) way to achieve this :)
<mellum>
gl: I'm very sure he does not want a single function, but rather something else, and just thought this was the proper mechanism
<gl>
phj you could speak :)
<phj>
Hadaka: at page 37,where have a title named "Pattern matching of a parameter" ,I'm learning how to use "function" .
* mattam
just found a bug in postgresql-ocaml :)
<phj>
gl: yes,I wan only one function.
<Smerdyakov>
mattam, why don't you like the ODBC interface?
<Hadaka>
phj: you haven't read the earlier sections too well - a function can take only one type of arguments in - and you cannot match on argument type
<phj>
s/wan/want
<mattam>
Smerdyakov: because there is nothing more that a function to get the results of a query!
<Smerdyakov>
mattam, so? What else do you want?
<mattam>
finding metainformation about the results, the number of affected lines of a query...
<phj>
Hadaka: one function can ONLY take one type of arguments,right ?
<phj>
in ocaml..
<Hadaka>
phj: yes
<Smerdyakov>
mattam, meta-information is available in the ODBC interface, via a more complicated querying function.
<phj>
I see.
<phj>
thank you all .
<mattam>
also async behavior would be nice
<gl>
you're welcome
<Hadaka>
alas, I have to hop off now
<mattam>
Smerdyakov: you mean i've got to create predifined querys for each thing i want, like getting the types of a result columns ?
<Smerdyakov>
mattam, yeah! And you'll LIKE IT!!!!!!!!
<mattam>
Smerdyakov: oh no, the result_info gives back your query string only (i have tested it)
<mattam>
really i wouldn't call that an interface, it's like only giving the 'get this over http' function in a libcurl binding, imo
<Smerdyakov>
Well, it's about the same kind of interface that I have in the SQL stuff for SML that I maintain. :P
<mattam>
i know, it may suit your needs, but not mine :)
<Smerdyakov>
However, instead of a query primitive that returns a list, mine folds over results. :)
phj has quit [Read error: 104 (Connection reset by peer)]
<CosmicRay>
ok, here's an incredibly general question -- if it's a FAQ please say so... I'm a Python programmer (with an interest in functional languages)... what are the top reasons I should switch to OCaml?
<CosmicRay>
I do a lot of database and network programming. Little parsing, but a lot of data transformations. Some GUI, some curses...
<CosmicRay>
I want something that scales nicely to large apps
<gl>
/me remember he had to take a look at the hcoop web site
<Smerdyakov>
Yes, you had to!! ;)
<gl>
let's go
<CosmicRay>
once thing about ocaml that attracts me is the static type system... though I make good use of type polymorphism in python...
<CosmicRay>
python is a little *too* weak for me sometimes. though not such an agregious offender as Perl
<CosmicRay>
whose types are roughly scalar and array :-)
<Smerdyakov>
Have you read the page I linked to, CosmicRay?
<CosmicRay>
loading it up now.
<CosmicRay>
that was an interesting overview.
<CosmicRay>
I wonder how expansive the built-in functional-style pattern matching is.
<Smerdyakov>
Expansive or expensive?
<CosmicRay>
could it, for example, be used to implement a parser grammar?
<CosmicRay>
expansive
<CosmicRay>
(for instance, are regexps supported as part of the pattern matching for a function?)
<Smerdyakov>
No regexps.
<Smerdyakov>
Use ml-lex and ml-yacc for parsing, as usual. :)
<CosmicRay>
what are the differences between OCaml, Caml Lite, and SML?
<CosmicRay>
is OCaml the one that is seeing the most new activity?
<Smerdyakov>
Caml Lite is only used for teaching.
<Smerdyakov>
I'd say OCaml and SML are pretty close in terms of work on the compilers themselves.
<Smerdyakov>
There are probably more OCaml libraries.
<Smerdyakov>
OCaml has OO stuff. SML doesn't.
<Smerdyakov>
Besides that, they are identical in all important ways.
<Maddas>
SML has call/cc :-)
<Smerdyakov>
No, SML/NJ has call/cc.
<Smerdyakov>
It's not part of the SML Definition.
<Maddas>
Oh, ok.
<gl>
Caml Lite ? Didn't you mean Caml light ?
<CosmicRay>
perhaps :-)
<Smerdyakov>
CosmicRay, now, if you like regular expression pattern matching, check out the XDuce language, which is designed for type safe XML processing.
<CosmicRay>
Smerdyakov: it's not a big deal to me; I know that ocaml supports regexps about as well as Python does.
<karryall>
CDuce also
<CosmicRay>
just thought I'd check, since the OCaml syntax in some ways reminds me of formal parser notations.
<Banana>
hum.... CDuce is still in early developpement. they barely have bytecode running now.
<Banana>
(I mean compiling to ocaml bytecode).
<Banana>
According to one of cduce developper : "Ocaml is a very good assembly language" :D
<TheDracle>
Heh.
<TheDracle>
CosmicRay: Whered you get your name from?
cjohnson has joined #ocaml
karryall has quit ["home"]
ski has joined #ocaml
ski has left #ocaml []
<CosmicRay>
TheDracle: well GammaRay was already taken on the network I first started IRCing on...