mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
|Catch22| has joined #ocaml
lordmetroid__ is now known as LordMetroid
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
LordMetroid has quit ["Leaving"]
adu has joined #ocaml
yangsx has joined #ocaml
yangsx has quit [Read error: 110 (Connection timed out)]
kopophex has joined #ocaml
r0bby has quit [Read error: 104 (Connection reset by peer)]
r0bby has joined #ocaml
jknick has joined #ocaml
netx has quit ["Leaving"]
travisbemann has joined #ocaml
kopophex has quit [Success]
adu has quit []
jknick has quit [Read error: 110 (Connection timed out)]
schme has joined #ocaml
netx has joined #ocaml
coucou747 has joined #ocaml
l_a_m has joined #ocaml
Linktim has joined #ocaml
Linktim_ has joined #ocaml
Jedai has quit ["KVIrc 3.2.4 Anomalies http://www.kvirc.net/"]
johnnowak has joined #ocaml
<johnnowak> hello all. silly question. how can I define an anonymous function in ocaml that takes no arguments?
<johnnowak> i just want to delay some computation
<pango_> there's no such thing as a function that takes no argument... make it take unit: ()
<johnnowak> that's what i figured. thanks
Linktim has quit [Read error: 110 (Connection timed out)]
Demitar has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
<flx> johnnowak, however, for delaying computation there may be a more suitable alternative: lazy evaluation. Lazy.force (lazy (4 + 3))
<johnnowak> ah nice, thank you
<flx> the difference is that you can Lazy.force a value many times but it gets evaluated only once
<johnnowak> right
Linktim_ has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
<evn> fg
<evn> oops
johnnowak has left #ocaml []
vfdfdfvd has joined #ocaml
travisbemann has quit ["leaving"]
coucou747 has quit [Read error: 113 (No route to host)]
hkBst has joined #ocaml
|Catch22| has quit ["To the best of my knowledge, I guess that I'm fresh"]
Yoric[DT] has joined #ocaml
<Yoric[DT]> thelema: ping
<thelema> Yoric[DT]: pong. I don't have time to talk, but I've also submitted "community ocaml" to ocamlcore.org. Do our projects have nearly identical goals?
<bluestorm> :D
<Yoric[DT]> That's the idea :)
<Yoric[DT]> That's the reason why I wanted to ping you.
<Yoric[DT]> In a few words: should I handle the library and Camlp4 and you handle the whole dist ?
<thelema> I'll have to modify your library to fit it into the dist...
<thelema> because of compilation order and things like .(x) / .[x] not working from inside the stdlib.
<thelema> err, .(x) doesn't work inside array.ml, .[x] doesn't work within String.ml
<bluestorm> is it not possible to keep a stdlib/extlib separation even in a common bundle ?
<thelema> and any references to ThisModule.foo get changed to just foo.
<thelema> bluestorm: it might be, but then it'd be unnecessarily difficult for users who want to look up the implementation of a function to find it.
<bluestorm> gnu/linux distributions often have a core/community/extra mirror separation for example
<Yoric[DT]> I'd keep the inrialib somewhere hidden in the distribution and only the extended stdlib visible.
<Yoric[DT]> Well, can you post as soon as you can the product of your reflexions on how the lib should be structured ?
<bluestorm> Yoric[DT]: i might be willing to help on the camlp4 side
<thelema> hmmm... To be honest, with modern SCM, it shouldn't be too difficult to manage by hand the extended-stdlib and extensions-as-separate-from-stdlib.
<thelema> also, I've not integrated all of extlib into communityocaml - there's better code available in places.
<thelema> bluestorm: I'm sure we'd love your help.
<Yoric[DT]> bluestorm: good.
authentic has quit [Read error: 110 (Connection timed out)]
<Yoric[DT]> thelema: we need to find a way of splitting work.
<thelema> I've gotta go. I'll think about how this should work and post later today.
<Yoric[DT]> What do you suggest ?
<Yoric[DT]> ok
<thelema> Yoric[DT]: lots of patch sharing. Git trees make this pretty simple.
<thelema> bye for now.
<Yoric[DT]> Sure but what does each of us do ?
<Yoric[DT]> bye
<thelema> well, github provides a feed of changes, subscribe to mine and watch what I change?
<Yoric[DT]> That's a low level approach.
<Yoric[DT]> I was more thinking about sharing responsibilities so as to not have twice the same project...
<Yoric[DT]> s/sharing/splitting/
<thelema> yes, there's no high-level splitting of responsibility, but there's some advantages in code review/quality
<Yoric[DT]> Anyway, you go and post something later :)
* thelema really has to go. bye
thelema has quit ["[BX] We are BitchX of Borg. You will be assimilated. Using mIRC is futile."]
<bluestorm> Yoric[DT]: on the camlp4 side there is a quite good structure proposition that was discussed on the mailing list
<Yoric[DT]> Do you have a pointer to the thread ?
<bluestorm> i was planning to learn how to use the involved tools, and then convert my own extensions to that
<Yoric[DT]> ok
<bluestorm> btw Yoric[DT], there is a Camlp4Parser that was added between 3.10 and 3.10.1 by Nicolas Pouillard and that basically use your "ugly hack" to handle both revised and classical syntax
<Yoric[DT]> What do you mean "ugly hack" :)
<Yoric[DT]> (I actually got that hack from Nicolas Pouillard in the first place, mind you)
<bluestorm> :p
<bluestorm> "try to delete something and if it fails, then it's the revised syntax"
schme has quit [Read error: 110 (Connection timed out)]
* qwr finally looked wtf the revised syntax is... doesn't really look like improvement to me.
<bluestorm> qwr: there are good and bad parts, but generally you need some time to get used to it
<bluestorm> in my experience, people are a bit disgusted at first, and then sometimes end up using it
<qwr> imho practically only thing where the revisised syntax is nicer is using curring on type expressions
pango_ has quit [Remote closed the connection]
<qwr> and disallowing &/or boolean aliases (i personally prefer and/or, but since and has different meaning in ocaml allowing or/& and ||/&& is messy)
pango_ has joined #ocaml
<qwr> on other stuff... just requiring extra () [] in code? extra do {}? wtf?
<bluestorm> currying on type expressions and variant expression/pattern
<bluestorm> the extra [ ] are debatable but they have nice side effects, eg. the possibility for a void type
authentic has joined #ocaml
<Yoric[DT]> qwr: I personally have adopted the revised syntax.
<Yoric[DT]> I like it.
<Yoric[DT]> It's not perfect, but I like it.
Anarchos has joined #ocaml
l_a_m has quit [Remote closed the connection]
l_a_m has joined #ocaml
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
schme has joined #ocaml
kig has quit [Remote closed the connection]
qebab has joined #ocaml
<orbitz> are you talking about having to do let f () = 5?
<orbitz> or what not?
<bluestorm> ?
<orbitz> qwr's question
ikaros has joined #ocaml
kopophex has joined #ocaml
pango_ has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
|Catch22| has joined #ocaml
pango_ has joined #ocaml
Morphous has joined #ocaml
ikaros has quit [Remote closed the connection]
LordMetroid has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
schme has quit [Remote closed the connection]
schme has joined #ocaml
Ramzi has joined #ocaml
kig has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
netx has quit [Remote closed the connection]
<Ramzi> What's the use of val over let?
<orbitz> val just tells you the types of somethign doens' tit? it doen'st let you define it
<Ramzi> Are they like header definitions in C?
<orbitz> it depends on how you mean 'like'
<orbitz> headers in C are very primitive and simply a preprocesosr trick
<orbitz> interfaces in ocaml are mroe robust
<orbitz> but the idea is similar: providing information on what things a module exports
<Ramzi> Can you look at a piece of code with me and tell me the role of certain keywords?
Anarchos has joined #ocaml
<Anarchos> the version 1.96 of driver/optmain.ml is buggy : last comment not terminated
<orbitz> Anarchos: thanks for the heads up
<orbitz> Ramzi: you can ask questions, if the documentation provides a better answer than I, i iwlld irect you to it
<Smerdyakov> Ramzi, it's better to post a link and let people look as they're so inclined.
<Ramzi> Okay.
<Ramzi> I think Smerdyakov anyway has a sense of how experienced I am with OCaml. It is not fluent yet and I feel like I'm trying to learn certain ideas of it with respect to other programming languages.
<Anarchos> orbitz i don't know what 'heads up' are
<orbitz> Anarchos: warning
<Anarchos> orbitz i had to revert to version 1.95
<orbitz> Anarchos: ok?
<Ramzi> First of all, what should I consider a module to be? Currently I view them as classes, in the object oriented sense.
<Smerdyakov> Ramzi, a module is a record of types and values.
<Anarchos> Ramzi modules are somewaht comparable to packages in java
<Ramzi> Okay. And I currently view types as "a new type of object" and values as "function header definitions"
<Ramzi> Is my schema flawed and how can it be better?
<Anarchos> Ramzi no values are values. The header- like notion is the .mli file, or interfaces describing what lies in a module
<orbitz> i think he is confusing 'value' with 'val' keyword
<orbitz> Ramzi: have you read the ocaml tutorial website yet?
<Ramzi> Yes. Please don't view this as an excuse, but I have difficulty learning a new language without intelligent guidance.
<Ramzi> Or sentient guidance, if that's more true.
<Smerdyakov> Ramzi, a value is anything that exists at runtime. Types describe values.
<Ramzi> Let's look at this line. type transition = int * char option * int
<Ramzi> So, tuples and lists are types, right?
<bluestorm> Ramzi: "let" definition are structure items
<bluestorm> "val" specifications are signature items
<bluestorm> for each structure item, you have a corresponding signature item
<Ramzi> type message = string is called what, "type specificiation"?
<bluestorm> it's a type declaration *and* a type specification
<bluestorm> depends on where you put it
<bluestorm> if it's inside a struct .. end block it's a declaration
<Ramzi> Can you put "type message = string" in both structures and signatures?
<bluestorm> you
<bluestorm> ..
<bluestorm> yes
<Ramzi> Okay. Now is the word "definition" used differently than "declaration" ?
<bluestorm> i use them interchangeably
<bluestorm> the opposition is between "definition" and "specification"
<Ramzi> Okay. Then finally, I can ask... Why make a distinction between signature items and structure items?
<bluestorm> Ramzi: it's the difference between an interface (signature) and it's underlying implementation (structure)
<bluestorm> you can have numerous implementations for a same interface, and vice versa
<orbitz> not all strucutre items need be part of the signature too, only those you wish to expose
<bluestorm> Ramzi: for example, if you develop a library, you want ask your users to read the code of your library, only the interface
<bluestorm> the interface has enough information for them to use it
<bluestorm> (and actually in the interface you can restrict what they can use, a bit like "private/public" in object oriented languages)
<Ramzi> Okay. So let me try to repeat that back.
<Ramzi> A signature is like a JAVA interface. It provides a bunch of stuff for someone else to implement.
<Ramzi> The implementation is the structure.
<Ramzi> Some modules want to give people already implemented functions. So those modules can have a structure.
<Ramzi> And some modules want to give people an interface, for them to implement. So those modules can have a signature.
<Ramzi> And some modules want to give people some implemented functions, and an interface. So those modules can have a structure and a signature.
<Smerdyakov> That doesn't make sense to me.
<orbitz> i don't think that is correct
<Smerdyakov> Every module has a signature.
<Smerdyakov> It's just a matter of if you write it out explicitly, or take the default one that is inferred.
<bluestorm> Ramzi: "modules" refer to an implementation and an interface
<Smerdyakov> bluestorm, I don
<bluestorm> you can't have a module implementation without an interface (although you can refine the interface later)
<Smerdyakov> 't agree.
<bluestorm> but you can have "module interfaces" with no associated implementation
<Smerdyakov> bluestorm, modules _have_ interfaces, but they don't _include_ their interfaces.
<bluestorm> hm
<kanjirev> is jocaml still being developed?
<bluestorm> kanjirev: i think so
<bluestorm> they published a job proposal recently
<Ramzi> bluestorm: I think I am most following the way you are describing these things.
<Ramzi> We first have a module NFA that has a signature. That makes sense to me.
<bluestorm> actually "module type" is a module interface declaration
<Ramzi> Can you explain, though, the purpose of putting "type" after "module"
<bluestorm> wich is why you have a "sig .. end" block, without struct .. end part
<bluestorm> "type nfa" is a type delcaration
<bluestorm> hmm
<bluestorm> type specification
<bluestorm> as "type nfa = string" for example
<Ramzi> so, if you do "module type" then you cannot have a struct .. end in that module?
<bluestorm> ah
<bluestorm> that "type" :p
<bluestorm> Ramzi: as-is, it's not a module, only a "module interface"
<bluestorm> to create a real module from it, you have to provide an implementation matching that interface
<Ramzi> so "module interfaces" ONLY HAVE signatures and no structures?
<bluestorm> yes
<Ramzi> okay, and if you use "module type" then you CAN'T put a struct .. end in there?
<bluestorm> no you can't
<Ramzi> Isn't the same effect achieve by just typing "module" (note: NOT "module type") and simply not putting in a struct .. end in there?
<bluestorm> in a "module" declaration, the struct .. part is mandatory (or it is an alias to another already-existing module)
<bluestorm> so you couldn't do that, you have to use "module type ..."
<bluestorm> Ramzi: now that your module interface NFA is defined, you can create a Nfa module with the NFA interface
<bluestorm> module Nfa = (struct ... end : NFA)
<bluestorm> or, equivalently, module Nfa : NFA = struct .. end
<Ramzi> Slow down a bit. Not there yet. :-P
<bluestorm> where ... should be structure items matching the NFA signature items
<Ramzi> Okay, so if I read "module type" I know I'm looking at an interface.
<bluestorm> that's it
<Ramzi> And if I read "module" it has to have a "struct .. end" in there?
<bluestorm> it has to be a real module (not only an interface)
<Ramzi> Phrased cruedly, I can call functions of that module.
<bluestorm> so yes, you have to put a struct .. end part, unless it is an alias of another existing module : module Foo = List ;; would work (the struct .. end part being the implementation of the List module)
<orbitz> bluestorm: what if it has a sig .. end ?
<bluestorm> orbitz: "it" ?
<pango_> bluestorm: don't forget the use of functors
<orbitz> can i do module M = sig .. end?
<bluestorm> pango_: :D
<bluestorm> orbitz: no you can't
* Yoric[DT] is wondering whether a Yacc (or Menhir) syntax extension would be interesting.
<orbitz> ok
<bluestorm> Yoric[DT]: to embed them into ocaml code ?
<Yoric[DT]> yep
<Yoric[DT]> Something like the stream parser syntax.
<bluestorm> hm, how heavy ?
<pango_> let's say struct ... end is a literal module definition, but they're other ways to define a module
<Yoric[DT]> bluestorm: what do you mean ?
<bluestorm> i don't see the common point between a litteral yacc-program inclusion, and the stream parser syntax (wich is a quite heavy syntax extension, in the sense that it performs a lot of camlp4-time manipulations)
* Yoric[DT] should have written Yacc-style.
LordMetroid has joined #ocaml
<Yoric[DT]> Well, I'm thinking of something like the stream parser syntax, but with backtracking (and optimizations, if possible).
<bluestorm> like parsec ?
<Yoric[DT]> Exactly.
<Yoric[DT]> But with syntax.
<bluestorm> (if you're considering a quite complex new software function, i think you should not begin with the camlp4 syntaxic sugar)
<Ramzi> alright, and then I think I have just two more questions.
<Yoric[DT]> At the moment, I'm just wondering whether it would be useful.
<Ramzi> The first is, just having "type nfa" what does that do
<Ramzi> It's making a new type, called nfa, but it's not telling me anything about it. What can it hold.
<bluestorm> Ramzi: it declares a nfa type, without giving you any information on it's implementation
schme has joined #ocaml
<bluestorm> that is an "abstract type" : you cannot create or introspect values from that type
<Ramzi> Ohhh! Because it's in the interface!
<bluestorm> you have to use the functions given in the module
<bluestorm> Ramzi: think of a library : you'll want to new specific type to your users, without allowing them to mess with the internal representation
<Ramzi> In the same way an interface provides "functions to be implemented," an interface provides, "types to be implemented."
<bluestorm> hm
<bluestorm> the idea of abstract types is more general than that
<bluestorm> but that's a way to see it
<Ramzi> And then lastly, module Nfa : NFA
<Ramzi> What's the role of this colon operator?
^authentic has joined #ocaml
<bluestorm> Ramzi:
<orbitz> "The expression ( module-expr : module-type ) checks that the type of module-expr is a subtype of module-type, that is, that all components specified in module-type are implemented in module-expr, and their implementation meets the requirements given in module-type. "
<bluestorm> this one is a real module declaration
<bluestorm> meaning "i declare a module Nfa whose interface is NFA"
<Ramzi> Makes sense.
<Ramzi> Is that the same colon operator as in val regexp_to_nfa : regexp -> nfa
<Smerdyakov> There is no "colon operator" in OCaml.
<bluestorm> not exactly because this one is a value/type assertion
<Ramzi> or is it an overloading of the colon
<bluestorm> while the module is a module implementation / module interface assertion
<bluestorm> and, as Smerdyakov say, ":" is not an operator, only a syntaxic construct
<bluestorm> (and there is no overloading in OCaml anyway, except for the comparison/equality operators)
<Smerdyakov> Well, I take that back.
<Smerdyakov> There is sort of a binary colon operator, if you put parens around the expression.
<Smerdyakov> But there are no operators in [val regexp_to_nfa : regexp -> nfa].
<bluestorm> Yoric[DT]: considering the camlp4 extensions to put in your "bundle" project, i have the feeling that we ought to have two different places : one whith a structured hierarchy of modules that make sens and behave well altogether, and one with only an extension list with an homogenous presentation
<bluestorm> Smerdyakov: so you would consider ( foo : bar ) as an operator ? why not
<bluestorm> but it's used with modules too
<Ramzi> Alright. I think I fully understand the things I was confused about when I first came in here.
<pango_> bluestorm: I don't think comparison/equality operators are overloaded, there's just one definition for each, which happens to be polymorphic
<bluestorm> hm, you're right
<Ramzi> Thank you for your patience and explanations bluestorm.
<bluestorm> you're welcome
<bluestorm> but i'm sure a lot of your questions would be better answered by reading a good ocaml tutorial
<bluestorm> (if you don't like ocaml-tutorial.org, there are a lot of other things out there)
evn_ has quit []
kanjirev has quit []
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
<Yoric[DT]> bluestorm: makes sense.
<Yoric[DT]> I was more interested in the first part, but yeah, the second does, too.
<bluestorm> of course the long-time goal is the first part
Jedai has joined #ocaml
<bluestorm> but i for example would not dare to put my own extensions in such a thing without some careful thinking and debate (that is, for long), while the second part would be a lot easier to access to
pango_ has quit [Remote closed the connection]
LordMetroid has quit ["Leaving"]
LordMetroid has joined #ocaml
filp has joined #ocaml
<bluestorm> do you know what should be put into the "Title" field of ocamlforge account creation form ?
pango_ has joined #ocaml
StoneNote has joined #ocaml
Mr_Awesome has quit ["aunt jemima is the devil!"]
<Yoric[DT]> I don't remember for sure.
<Yoric[DT]> I assume it's nothing for you yet :)
<Yoric[DT]> Or, more generally, "M.D.", "PhD", "Lord", "Dr. Ingr" or whatever you want to prefix your name.
<bluestorm> so putting my nickname was actually a bad idea :D
<bluestorm> on the other hand, "Future World Ruler" sounds nice
<Yoric[DT]> Fair enough.
<Yoric[DT]> You'll need a good campaign manager, of course.
filp has quit ["Bye"]
<bluestorm> actually, as i had to give my real name, i already have to endorse crappy programmer activities, so i should try to behave myself
ygrek has quit [Remote closed the connection]
* qwr . o O ( why you have to endorse programming activities? )
l_a_m has quit [Remote closed the connection]
schme has quit [Connection timed out]
netx has joined #ocaml
LordMetroid has quit ["Leaving"]
kopophex has quit [Connection timed out]
bluestorm has quit [Remote closed the connection]
bluestorm has joined #ocaml
kopophex has joined #ocaml
vfdfdfvd has quit [Remote closed the connection]
sporkmonger has joined #ocaml
<sporkmonger> How do you deal with types that reference each other? I have a type Predicate.t that should contain a Act.t list, but Act.t needs two Predicate.t variables. OMake yells at me for having a deadlock.
<sporkmonger> What's the best way to resolve this?
hkBst has quit ["Konversation terminated!"]
<qwr> put'em into one module (or module interface)
* qwr . o O ( maybe something could be also done with abstract types? )
<sporkmonger> i'm still very new to OCaml coding style
<sporkmonger> but Foo.predicate_t and Foo.act_t seems ugly to me
<sporkmonger> since the two are very distinctly different structures in my code
<qwr> sporkmonger: then open Foo
<sporkmonger> they definitely feel like they should be in different modules
<sporkmonger> is there a way to override the module that OCaml sticks stuff in?
<sporkmonger> like, have them both be in foo.ml, but put them in separate modules?
<qwr> sporkmonger: include module?
<sporkmonger> (i'm newb enough that that explanation didn't help)
<qwr> you can include one module into another
<qwr> so the another module will contain all of the included modules definitions
* qwr . o O ( damn, if i'll teach long enough others on this channel, i will finally learn how the ocamls module system works :P )
<sporkmonger> lol
<sporkmonger> bah, i have to run, i'll probably have to reask later
<sporkmonger> thanks anyway
<qwr> include Modulename;;
<qwr> but i don't know, what you really wanted with override
<qwr> include just allows to define stuff in one module and then spread it into n another one
Yoric[DT] has quit ["Ex-Chat"]
<orbitz> include?
<orbitz> not 'open?
<qwr> open takes stuff into module implementations namespace
<qwr> include also exports it
<orbitz> oh ok
<orbitz> oh durh
ikaros has quit ["segfault"]
bzzbzz has quit [Read error: 110 (Connection timed out)]
nuncanada has joined #ocaml