dylan changed the topic of #ocaml to: OCaml 3.09.1 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
<ketty> you could still try the dumpable aproach :)
<ketty> are all values you want to store in the graph points?
<multani> i didnt' tell anywhere that the graph object (of type graph_subject), what it's type-variables are ... How do it knows ?
<multani> no, points are just one kind of figures, i have to add other figures after that ^^
<ketty> i doesnt know... but as soon as you use it with something it decides :)
<multani> ok, that's what i understand, but I wasn't sure :)
<ketty> ok, how does the definition of figure look? :)
<ketty> we probably want a class dumpable_figure...
<ketty> that is a subclass of figure..
<ketty> (or we could add dump_xmlrpc as a virtual method to figure)
<multani> in fact, we should not touch to figure, and all things which turn around (point, etc.)
<ketty> then we need to define dumpable_figure...
<multani> the idea is to have a generic package which deal with figures, and we have to use and specialised this package to use it with xmlrpc & mvc
<multani> so, you propose to add a dumpable_figure class, which has dump_xmlrpc, and then, point_subject inherits from dumpable_figure, & point & subject ?
<ketty> i does not need to inherit from dumpable_figure...
<ketty> because point inherits from figure
<ketty> and it defines a dump_xmlrpc
<ketty> so it will automaticaly "conform with the dumpable_figure interface"
<ketty> maybe do: class virtual dumpable = object method dump_xmlrpc : unit -> ??? end
<ketty> and dumpable_figure inherit from dumbable and figure
<multani> could dumpable_figure be virtual too ?
<ketty> and point_subject (and other dumpable figures) will inherit from dumpable as well as a subclass of figure
<ketty> yes it could be virtual
<ketty> in fact, it probably should be
<multani> cool :)
<multani> well, and where should I use dumpable_figure ? (in point_subject, and ?)
<ketty> (p :> dumpable_figure)
<ketty> that is probably all you need to do
<ketty> (i hope ^^)
<multani> WOOT
<ketty> it works?
<multani> hey, it works :D
<ketty> yay!! :)
<multani> now, i must try to understand, HOW ? :D
<ketty> heh :)
<ketty> i think all that OO is a bit confusing.. :)
<multani> hmm, i will to small schema, it will help ;)
<multani> thanks a lot
<multani> you will be in the project's credits ;)
<ketty> heh :)
exa has quit [Remote closed the connection]
<multani> does someone has used with xmlrpc and ocaml ?
<multani> hum
<multani> is there someone who already used xmlrpc with ocaml ?
<ketty> multani: i haven't used it...
shawn has quit [Connection timed out]
dbueno has joined #ocaml
mikeX has quit ["zzz"]
dbueno has quit ["Leaving"]
<multani> good nigth, thanks for all ketty
multani has quit ["Parti"]
khaladan has quit [Read error: 110 (Connection timed out)]
CosmicRay has joined #ocaml
CosmicRay has quit ["Client exiting"]
jcreigh has joined #ocaml
jcreigh has quit ["leaving"]
Smerdyakov has quit ["Leaving"]
dark_light has quit [Read error: 104 (Connection reset by peer)]
ayrnieu has quit ["system"]
ramkrsna has quit [Remote closed the connection]
bohanlon has quit [Read error: 110 (Connection timed out)]
ramkrsna has joined #ocaml
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
ramkrsna has joined #ocaml
pango is now known as pangoafk
ayrnieu has joined #ocaml
pangoafk is now known as pango
Tachyon76 has joined #ocaml
andreas_ has joined #ocaml
<andreas_> Hi
<andreas_> type aa =
<andreas_> A
<andreas_> | V
<andreas_> | F
<andreas_> | P
<andreas_> | M
<andreas_> | I
<andreas_> | L
<andreas_> | D
<andreas_> | E
<andreas_> | K
<andreas_> | R
<andreas_> | S
<andreas_> | T
<andreas_> | Y
<andreas_> | H
<andreas_> | C
<andreas_> | N
<andreas_> | Q
<andreas_> | W
<andreas_> | G
<andreas_> | Any
<andreas_> | Gap
<andreas_> | Endgap
<andreas_> | Undef ;;
<andreas_> type ss =
<andreas_> G
<andreas_> | H
<andreas_> | I
<andreas_> | T
<andreas_> | E
<andreas_> | B
<andreas_> | S
<andreas_> | C
<andreas_> | Unknown
<andreas_> | Whitespace
<andreas_> | Undef ;;
<andreas_> Could anybody tell me if it is ok to use the same contructors in two different types?
<andreas_> For example: Undef in aa Type and Undef in ss type?
<ayrnieu> you could have put both of those in one line each, with minimal effort. You also could have pasted them online, and given us a link. You also could have asked your question, it being mostly independent. You also could have /tried it/, and paid attention to any errors.
<andreas_> actually you are right, sorry for the spam :/
<ayrnieu> I don't have an ocaml here, just now, so I can't try it and tell you what you'd see yourself; also I'm new myself. But I would think: no; you can have them in different modules though.
<andreas_> the code does compile, but I am still unsure how the type inference works with constructs like that
<ayrnieu> probably it infers the type :-)
<ayrnieu> note that list constructors are all []
<ayrnieu> so now I think 'yes', to contradict myself. Please paste all of that into an interactive ocaml and investigate: A;; E;; [A;E];; [T;Any];; [T;Unknown];; [Gap,Whitespace];;
<andreas_> thx
<flux__> andreas_, it will fail, the later definition of the constructor is the one that'll be used
Revision17 has joined #ocaml
<andreas_> but putting the definitions in two separate modules would work?
<flux__> yes
<flux__> like, module A = struct type t = A | B end module B = struct type t = A | B end
<andreas_> and I could still open the two modules at the same time without the type confusions? (the names of the conversion functions are unique)
<flux__> nope, the same problem occurs
<flux__> to unambgiously refer to a name you must use the Module.Constructor notation
<flux__> (although there is no ambigiousness as the later 'open' will always override previous ones)
<andreas_> so, the only real option is to put the definitions in two separate modules, without opening those, but refering with Module.Constructor/function to their contents
<flux__> yes
<flux__> sometimes you may use let module A = LongModuleName in .. -syntax to shorten the module names
<flux__> of you may get the openin language extension from caml humps, which allows you to write open Foo in expr
<andreas_> well, the modules names should not be a problem since they will be quite short: aa and ss
<ulfdoz> I don't understand, the Set.Make(...).iter thingy. As I gav
<ulfdoz> ... have to give a funktion of type elt -> (), there must be side effects and so I need an assignment to the given element in in this function. Isn't that only possible with mutable record variables?
<flux__> andreas_, also, traditionally you may use type name 't', if there is only one 'main type' in the module (module names themselves will have their first letter in upper case though)
<andreas_> thx, I think I will define the types in separate modules and put the conversion functions in a utlils module which I then should be able to open without type confusions, right?
<flux__> sounds about right
<andreas_> so no more "type ss" but "type t" instead
revision17__ has quit [Read error: 110 (Connection timed out)]
<ulfdoz> Wouldn't the constructor being decidable, when placing an explicit signature like let t = Undef : ss in ...
<andreas_> but then I would have to remind myself to always use the Undeff::ss right?
<ulfdoz> yes, or compiler can infer from context, what it usually is able to.
<andreas_> I think I will stick with two different modules for aa and ss, seems to be cleaner
<ulfdoz> There's no generalized way for printing values in ocaml (similar to show in Haskell)?
<flux__> there are language extensions that emulate haskell's 'deriving'-feature, check out camlhump
<flux__> and there are some generic data dumping libraries, but I think they are more aimed at debugging
<flux__> other than that, I don't think so
andreas_ has quit []
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
m3ga has joined #ocaml
andreas_ has joined #ocaml
slipstream has joined #ocaml
<andreas_> what was the syntax for accessing record fields from outside a module again?
<andreas_> var.ModuleName.field_name does not work
<pango> that's how it's supposed to work, so you have an error elsewhere
YASP-Dima has quit ["I like core dumps"]
<andreas_> so aln.Alignment.x_char shoud work if "Alignment" is the Module and aln a record with field x_char
<pango> yes
<andreas_> I get an "Unbound value aln" error
<pango> then aln probably doesn't exist in the scope of this code
<flux__> a problem some people encounter is that they say module Foo = struct .. end inside file foo.ml, which itself is already in module Foo
pango is now known as pangoafk
ski has joined #ocaml
Skal has joined #ocaml
Schmurtz has joined #ocaml
andreas_ has quit []
m3ga has quit ["disappearing into the sunset"]
ramkrsna is now known as rk_afk
__DL__ has joined #ocaml
Snark has joined #ocaml
Revision17 has quit ["Ex-Chat"]
pangoafk is now known as pango
andreas_ has joined #ocaml
Skal has quit [Remote closed the connection]
srle has joined #ocaml
<srle> hi, all
<srle> can someone explain me uses of polymorphic variants
<srle> I don't get it
<flux__> if I use them, I mostly use them for avoiding naming the type I'm using, for values like `Success or `Failure error ;)
<flux__> I understand they have the potential of allowing greater extensibility of code, though, but I haven't seen a compelling example of that
<srle> flux__ : i don't se any uses for it, neither
<illya23b> it can be useful, e.g., for command processing...
<illya23b> if you have a toplevel that will take a set of commands, and you want to pass on certain categories of commands to other functions
<illya23b> then you can easily describe a type including all possible commands, and describe types for subsets of commands for your sub-functions
<illya23b> this way, you don't have to match with _ in the sub-functions
mecolin has quit [Read error: 110 (Connection timed out)]
Smerdyakov has joined #ocaml
Schmurtz has quit ["Plouf !"]
mecolin has joined #ocaml
<srle> illya23b : can you give me the link to some page that shows the REAL usses of variants, or the exaple that you gave me
<illya23b> srle : we're using it for a software project I'm working on, I can tell you more when I get back in ~hr... :)
<srle> illya23b : ok
<Smerdyakov> srle, just look at any compiler, theorem prover, etc., and how it represents abstract syntax trees.
<Smerdyakov> Or at any program that uses lists, for that matter.
<srle> Smerdyakov : I have to see real example, I have bad imagination :), do you have any link
<Smerdyakov> srle, have you seen lists in OCaml?
<srle> yes
<srle> and?
<Smerdyakov> srle, lists are a variant type.
<srle> why?
<srle> I thought that Lists are just lists.
<Smerdyakov> Because that's how they're defined..
<Smerdyakov> And "List" with a captial 'L' has no meaning in OCaml.
<srle> do you mean, polymorphic variants
<Smerdyakov> Besides the standard library modue
<Smerdyakov> srle, are you asking about polymorphic variants?
<srle> yes
<Smerdyakov> srle, then you should have said so. :P
<srle> ok, my fault
<Smerdyakov> srle, I've not yet seen anything to convince me that those should ever be used.
<srle> I have concluced the same
<srle> what do you think about objects in ocaml.
<srle> I think that they sucks.
<Smerdyakov> Same conclusion; never use them. :)
<srle> in the same way that pol var sucks
<dylan> the polymorphic variants are slightly easier produce in C code.
<dylan> in that they are represented as the hash of a string. Wereas normal variants are integers.
<srle> my conclusion is that o'caml doesn't have any benefits over caml
<srle> am I right?
<dylan> ocaml compiles to native code on amd64. :)
<srle> but people that use o'caml are just using caml features
<dylan> mlton doesn't yet do this. This is somewhat minor, but annoying when one's only machine is amd64.
<srle> people don't use objects in o'caml
<srle> they are too verbose, and unflexible
<dylan> I'm under the impression that both polymorphic variants and objects were added to make writing bindings to gtk 'easier', for a strange sense if easier.
<Smerdyakov> srle, Caml Light isn't maintained anymore, as I understand it.
<Smerdyakov> srle, all of the routine improvements go to OCaml.
<dylan> especially polymorphic variants. in pure ocaml code, they are useless. But when talking to some ocaml-aware C code, they are very useful.
<Smerdyakov> srle, that is why, if you want to use Caml, there is no reasonable choice but OCaml.
<Smerdyakov> srle, but I usually choose Standard ML, anyway. :)
<srle> Smerdyakov : I am aware of the. I just want to point out that people use caml features in o'caml. People dont like new features in ocaml (objects, polymorphic variants)
<Smerdyakov> srle, that's not correct. OCaml has many non-OO features that Caml doesn't have, such that there is no choice but to classify these features as "OCaml features."
<srle> Smerdyakov : can you name some, please
<Smerdyakov> srle, camlp4
<Smerdyakov> srle, the standard library
<srle> ok
* dylan idly wonders about a version of ocaml without objects called McCaml or FitzCaml.
<Smerdyakov> Extra goop like optional arguments, named arguments, ...
<dylan> named/optional arguments are nice.
<Smerdyakov> Maybe the whole FFI... does Caml Light have one?
<srle> those are the features that are easy to add to caml
<Smerdyakov> But no one will ever do it.
<srle> or people can just remove objects and pol var from o'caml
<Smerdyakov> But no one will ever do it.
<srle> Smerdyakov : i agree with you
<Smerdyakov> I recommend simply using SML instead. :)
<Smerdyakov> Or use Coq instead!
Tachyon76 has quit [Remote closed the connection]
<srle> i have to go, bye
srle has quit ["BitchX: shaken, not stirred"]
<andreas_> is there something like "continue" for ocaml for loops?
<pango> that shouts "imperative spaghetti code" ;)
<Smerdyakov> andreas_, you will be assaulted for using loops in OCaml!
<sieni> andreas_: you can always use recursion
<andreas_> I know, I know, me culpa..
<andreas_> so there is no "continue" equivalent in ocaml?
<andreas_> imperative programming is not always bad, is it?
<pango> I don't know how to work around the lack of continue, there's no goto either
<andreas_> thx anyway
_JusSx_ has joined #ocaml
<_JusSx_> hi ocaml ppl
<flux__> you could use exceptions
Schmurtz has joined #ocaml
Skal has joined #ocaml
<flux__> but it doesn't mean you should ;)
<andreas_> I will give it a try
<sieni> can't you just use recursion like anybody else? :-)
<flux__> hmph, language shootout doesn't appear to anymore have an exception throwing benchmark
<flux__> are ocaml exception fast, fast enough for using them for program flow control?
<andreas_> I am rewriting program from c++ to ocaml, so sticking with imperative style makes it a little easier to do
<pango> flux__: I think ocaml exceptions are extremely fast
<andreas_> have to go, see you soon
<andreas_> bye
andreas_ has left #ocaml []
<_JusSx_> hum converting C++ code to oaml code by using imperative feature of ocaml
<_JusSx_> that's shit
<flux__> I can see how attempting to maintain 1:1 relationship between the two pieces of code can be valuable
<Schmurtz> _JusSx_, it's not made for that ;)
khaladan has joined #ocaml
pango is now known as pangoafk
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
pangoafk is now known as pango
khaladan has quit [Connection timed out]
smimou has joined #ocaml
Revision17 has joined #ocaml
shawn has joined #ocaml
mecolin has quit [Read error: 104 (Connection reset by peer)]
mecolin has joined #ocaml
_JusSx_ has quit ["leaving"]
_JusSx_ has joined #ocaml
davide has joined #ocaml
davide has left #ocaml []
mecolin_ has joined #ocaml
shawn has quit [Connection timed out]
mecolin has quit [Read error: 110 (Connection timed out)]
Snark has quit ["Leaving"]
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
Schmurtz has quit [Read error: 110 (Connection timed out)]
bzzbzz has joined #ocaml
_JusSx_ has quit ["leaving"]
__DL__ has quit ["Bye Bye"]
shawn has joined #ocaml
mikeX has joined #ocaml
Skal has quit [Remote closed the connection]