jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
_fab has joined #ocaml
_velco has joined #ocaml
Snark has joined #ocaml
smimou has joined #ocaml
Smerdyakov has quit ["Leaving"]
ramkrsna has quit [Connection timed out]
ramkrsna has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
velco has joined #ocaml
Wild_Cat has joined #ocaml
<dark_light>
i have two records that has equals fields instead of one.. the records are named substantivo_t and artigo_t.. i am returning a valid substantivo_t, but the compiler is saying that The record field label proprio belongs to the type substantivo_t but is here mixed with labels of type artigo_t (proprio is the field that is on substantivo_t but not in artigo_t).. someone knows how fix it?
<dark_light>
i tried to manually define the type of exit, trying to do ({field_a=value; fieldb_value} : substantivo_t), but i got a syntax error..
<dark_light>
(and i don't want to manually define the type of returning value!)
<pango>
fields name are associated with the module namespace
<pango>
so if you want to use the same field name, you have to define the record types in different modules
smimou has quit ["bli"]
<dark_light>
well.. so i think it is a poor choice..
<dark_light>
maybe i will use a object instead..
<pango>
or just don't use the same field name in different record types within the same module
<flux__>
using such fields from other modules can be slightly painful though, with value.OtherModule.fieldname :/
<flux__>
maybe using objects would be a nice alternative. one will lose pattern matching then, though.
<dark_light>
pattern matching? how can i do pattern matching with records?
<pango>
{ field_a = x } -> f x
<dark_light>
nice
<flux__>
there's a lighter requirement for module names in pattern matchin, the module name needs to be stated only in the first fields
<dark_light>
i though in use a array, of a variant type like.. Type1 of .. | Type2 of .., but it was too complicated
<dark_light>
i think in objects as it being a unecessary overhead (for this program at least), but i don't know how much
<pango>
what's the relation between the two record types ? maybe one should be included in the other, for example
<pango>
or you should use only one type, with extra fields being option types
<dark_light>
option types?
<pango>
type 'a option = None | Some of 'a
<dark_light>
Hmm
<dark_light>
pango, both represent a word, one representing a article ("the", "a", "an".. but in portuguese) and the other a noun, but in portuguese. it stores the word and additional info (the gender, the plural/singular..)
<dark_light>
first i tryied to make a 'word' type, like type 'a word = ..., but it was too complex
<pango>
do you expect to extend your design to other kinds of words ?
<dark_light>
yes
<dark_light>
pango, the types must not be exactly the same so logical type errors can be detected at compile time
<pango>
if there's a clear hierarchy between all words, then maybe object classes is the right approach
<dark_light>
pango, and all objects inherits the proprierties of a generic "word" class?
<pango>
OCaml's OO is structural, so you don't need something like that, afaik
<pango>
that said, I never used OCaml's OO ;)
<pango>
(so I wonder if the hierarchical constraint is even necessary)
<pango>
(that said, it makes the inheritance, hence the OO approach, more attractive)
<dark_light>
pango, i didn't understand, why i don't need something like that?
<pango>
# let print_word word = word#print () ;;
<pango>
val print_word : < print : unit -> 'a; .. > -> 'a = <fun>
<pango>
means that print_word can be called on any object, as long as it has a print method, of type unit -> 'a
<pango>
no need for a base class or anything
<dark_light>
but, hm.. a word basic class would be useful for keep the basic things that all words have
<pango>
yes, it's just that from the point of view of types, it's not a requirement
<dark_light>
pango, but it isn't the default in OO? two classes that are the same but one inherits some things of a parent, are equivalents
<dark_light>
i think C++ behaves this way too
<flux__>
dark_light, but in ocaml you don't need to inherit from anything
<flux__>
dark_light, it is simply enough that you provide the method of the required signature
<dark_light>
hmmm.. there are languages that requires the class to inherit?
<flux__>
c++, java
<flux__>
many others
<dark_light>
didn't know:)
<pango>
I think you'll have to read, then experiment a bit with OCaml's OO...
<pango>
it has its own load of concepts and restrictions attached, I can't tell if it's the best approach for your problem
Carillon_ has quit [Read error: 104 (Connection reset by peer)]
Carillon_ has joined #ocaml
dark_light has quit [Remote closed the connection]
dark_light has joined #ocaml
slipstream-- has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
f78 has quit ["Leaving"]
<flux__>
hm, where can I find documentation for ocamlmklib?
<flux__>
ah, there is something in the chapter describing how to interface with C
Eelis_ has joined #ocaml
<flux__>
ah, I had foo.c and foo.ml, and things worked just great until I enabled native code generation which clobbered file foo.o
Eelis has quit [Read error: 110 (Connection timed out)]
<flux__>
apparently luck was slightly involved, because sometimes I managed to generate a working library
gottreu has joined #ocaml
jewel has quit [Read error: 110 (Connection timed out)]
Eelis_ is now known as Eelis
bolsen has joined #ocaml
Smerdyakov has joined #ocaml
* Snark
generally has foo_stub.c for foo.ml
ramkrsna is now known as rk_afk
gottreu has left #ocaml []
Revision17 has joined #ocaml
Wild_Cat has quit ["tiuq\"]
velco has quit ["bbl, requests to _velco"]
smimou has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
_velco is now known as velco
flux__ has quit [Read error: 104 (Connection reset by peer)]
flux__ has joined #ocaml
fremo has joined #ocaml
<fremo>
hello
<zmdkrbou>
lo
_jol_ has joined #ocaml
Carillon has joined #ocaml
slipstream-- has quit [Read error: 54 (Connection reset by peer)]
slipstream has joined #ocaml
SEAMOSS has joined #ocaml
Carillon_ has quit [Connection timed out]
SEAMOSS is now known as Carillon_
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
Carillon has quit [Success]
Snark has quit ["Leaving"]
chessguy has joined #ocaml
_jol_ has quit ["leaving"]
f78 has joined #ocaml
DRMacIver has joined #ocaml
<DRMacIver>
Sigh
<DRMacIver>
It makes me sad when there's something a language does so very much better than anything else out there, and it's still not good enough.
<DRMacIver>
(ML and OCaml's pattern matching)
<DRMacIver>
Well, pattern matching in function definition.
Eelis has quit [" "]
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
dark_light has quit [Read error: 110 (Connection timed out)]