Banana has quit [Read error: 110 (Connection timed out)]
pac_ has quit [Read error: 110 (Connection timed out)]
pac_away has quit [Read error: 110 (Connection timed out)]
pac_away_ has quit [Read error: 110 (Connection timed out)]
KrispyKringle has joined #ocaml
mvil has joined #ocaml
gim has quit ["dodo ()"]
yauz_ has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
yauz has quit [Read error: 104 (Connection reset by peer)]
KrispyKringle has quit ["Leaving"]
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
Research has joined #ocaml
CosmicRay has joined #ocaml
pac_away1 has quit ["leaving"]
mvil has quit ["and then... it EXPLODED"]
smimou has quit ["?"]
GreyLensman has quit ["Leaving"]
CosmicRay has left #ocaml []
Herrchen_ has joined #ocaml
Herrchen has quit [Read error: 110 (Connection timed out)]
cjohnson has quit [Read error: 104 (Connection reset by peer)]
vezenchio has joined #ocaml
monotonom has joined #ocaml
Nutssh has joined #ocaml
Research has quit [Remote closed the connection]
debona|r has quit [Read error: 104 (Connection reset by peer)]
mrsolo has quit [Read error: 104 (Connection reset by peer)]
mrsolo has joined #ocaml
mellum has quit [Ping timeout: 14400 seconds]
debona|r has joined #ocaml
det_ has joined #ocaml
det has quit [Read error: 60 (Operation timed out)]
ionOS has joined #ocaml
monotonom has quit ["Don't talk to those who talk to themselves."]
det_ has quit ["leaving"]
det has joined #ocaml
skylan has quit [Remote closed the connection]
skylan has joined #ocaml
Tchou has joined #ocaml
maihem has joined #ocaml
buggs^z is now known as buggs
mrsolo has quit [Read error: 60 (Operation timed out)]
_fab has quit []
mellum has joined #ocaml
aze has quit [Remote closed the connection]
smimou has joined #ocaml
gim has joined #ocaml
smimou has quit ["?"]
smimou has joined #ocaml
vincenz has quit [Read error: 104 (Connection reset by peer)]
Nutssh has quit [Read error: 110 (Connection timed out)]
gkoller has joined #ocaml
<gkoller>
I am reading up on Ocaml and was wondering what a good representation of an IPv4 address would be in Ocaml given that the runtime uses 1 bit of an int, leaving 'only' 31 bits to play with
AshW8rk3 has joined #ocaml
<pnou>
what about two ints?
_fab has joined #ocaml
<gkoller>
should work, though lazy as I am that would mean I'd need to write more code than necessary ;-) int64 is only available on 64 bit platforms right?
<pnou>
no, on all platforms
cjohnson has joined #ocaml
<gkoller>
'problem' solved in that case
gkoller has quit ["ChatZilla 0.9.61 [Mozilla rv:1.7.1/20040707]"]
AshW8rk3 has quit [Remote closed the connection]
GreyLensman has joined #ocaml
cjohnson has quit [Connection timed out]
cjohnson has joined #ocaml
cjohnson has quit [Read error: 104 (Connection reset by peer)]
AshW8rk3 has joined #ocaml
AshW8rk3 has quit [Remote closed the connection]
monotonom has joined #ocaml
Nutssh has joined #ocaml
mrsolo has joined #ocaml
AshW8rk3 has joined #ocaml
det has quit [Read error: 60 (Operation timed out)]
AshW8rk3 has quit [Remote closed the connection]
whee has joined #ocaml
avlondono has joined #ocaml
pac_away has joined #ocaml
AshW8rk3 has joined #ocaml
Riastradh has quit ["exchanging power cords & UPSs"]
AshW8rk3 has quit [Remote closed the connection]
_fab has quit []
Tipsy has joined #ocaml
<Tipsy>
greting
<Tipsy>
anyone here?
<Nutssh>
Hi.
<Tipsy>
i am java, and python code
<Tipsy>
coder
<Tipsy>
i have been hearing a lot about ocaml
<Tipsy>
what can you tell me? is it a good language?
<Smerdyakov>
It is.
<Smerdyakov>
Tipsy, are you associated with CMU at all?
<Tipsy>
yes i am
<Tipsy>
why?
<Tipsy>
do you know me?
<Smerdyakov>
All CS students at CMU have to learn about ML. :)
<Tipsy>
i am not CS
<Tipsy>
but i have taken the class
<Smerdyakov>
I'm a CMU CS alum.
<Tipsy>
ahh
<Nutssh>
Smerdyakov, what year?
<Smerdyakov>
15212, you mean?
<Tipsy>
15213
<Tipsy>
Zip code?
<Smerdyakov>
Nutssh, 2003
<Tipsy>
oh
<Tipsy>
i took the PhD Lvl
<Tipsy>
which i dropped
<Tipsy>
but they were teaching ML
<Tipsy>
it's a nice language
<Nutssh>
I was 2000. Did you hang out in the lounge?
<Smerdyakov>
Tipsy, Type Systems?
<Tipsy>
Programming Language
<Smerdyakov>
Nutssh, no.
<Tipsy>
wow
<Tipsy>
are you guy all CMU?
<Smerdyakov>
Nutssh, I started in Fall 2000.
<Tipsy>
well
<Tipsy>
is it true that OCAML is fast?
<Tipsy>
almost as fast as C?
<Nutssh>
Fast enterance and exit. :) I hung around as staff for two years after I graduated.
<Smerdyakov>
Tipsy, the PL class by Brooks?
<Tipsy>
it was long ago
<Tipsy>
don't remember
<Nutssh>
Tipsy, its fast to program in, and its execution performance isn't a problem.
<Tipsy>
what is ML relation with CMU
<Smerdyakov>
The OCaml compiler is highly competitive with GCC for optimization, yes.
<Tipsy>
OCAML vs java?
<Smerdyakov>
One of the authors of the Standard ML Definition (Bob Harper) is a professor at CMU.
<Nutssh>
Smerdyakov, bullshit. :) Ocaml as an optimizing compiler sucks.
<Smerdyakov>
Almost all the PL faculty at CMU are strong ML fans.
<Tipsy>
How does OCAML run on Mac OS X?
<gzl>
it runs fine
<Tipsy>
are you on OS X?
<gzl>
yes
<Tipsy>
i am asking this because some languages like Java has to die on OS X
<gzl>
?
<greenrd>
Java is a fine language.
<Tipsy>
very slow
* greenrd
ducks
<Tipsy>
and unoptimized on S X
<Tipsy>
OS X
<Tipsy>
gzl: where do I get started and download OCAML for OS X?
<gzl>
i haven't had too much trouble with it.
<gzl>
easy enough to just use Fink.
<Tipsy>
ahh
<Tipsy>
thanks
_fab has joined #ocaml
<Tipsy>
What do you guys use OCAML for?
<Tipsy>
I was actually a fan of Lisp
<Tipsy>
I did CS undergrad at U Chicago, and they love Lisp over there
<Tipsy>
ML is quite similiar i remember
<Nutssh>
Ever look at code for 'let foo x = x*x*x*x*x'? It reads the argument, copies it to 4 new registers detags it 4 times. For symbolic stuff it might not matter, but I do a lot of ocaml for brute integer processing.
<greenrd>
That's nuts.
<Nutssh>
Its enough to make you cry.
<Tipsy>
wow u guys are hardcore
<Smerdyakov>
Nutssh, ML is much better than Lisp for real development. :)
* avlondono
proceeds to check Nutssh claim
<Nutssh>
I suspect the only way it wins is because modern superscalar CPU'ss can dispatch out the detagging operations concurrent with real work.
<Tipsy>
Nutssh: i have no idea what u are talkin about
<Nutssh>
I just reverified my claim.
<avlondono>
you're right, I just wanted to see it myself
<Nutssh>
Smerdyakov, yup. Thats why I use it. Apart from other things, typesafe closuers, and I love my closures.
<Nutssh>
I considered adding in a quick cheap value numbering pass to detect redundancies, it'd be perfect for this.. But the ocaml intermediate language is... not well designed for it, so what I was hoping would be a weekend project would take a lot longer.
<Tipsy>
Where can I read about file access with OCAML?
<Nutssh>
See the standard library, you eiter want Pervasives or Unix.
<Nutssh>
Ocaml's a great langauge, but its definitely not optimized. :(
<monotonom>
There are a thousand people optimizing C or Java. There are a dozen people optimizing OCaml. If only just 10% of the former resigned and joined the latter...
<Nutssh>
Heh.. Rice has a good compilers group and osmosis happens. I asked keith the two most useful thing to add. Value numbering (redundancy elimination) and loop invariant code motion were the two suggestions. And loop invariant code motion can be had almost for free.
<monotonom>
As it is, a 100:1 ratio of man-hour and a 2:1 ratio of speed is already very telling.
<Nutssh>
Well, thats not entirely fair. Speed critical inner loops are almost always done in C.
<monotonom>
Yes, for speed-critical inner loops, C is twice as fast as OCaml, that is why C is preferred.
<monotonom>
And C is twice as fast because a hundred times more man-hours are put into optimizing it.
<mrsolo>
well java is still slower than ocaml no?
<Smerdyakov>
monotonom, I don't think that is set in stone. If we're talking about SML, where we can be talking about more than one compiler, it's very reasonable to expect identical performance.
<monotonom>
I am fixing OCaml for the sake of concreteness.
KrispyKringle has joined #ocaml
<Nutssh>
This is touching on the world of benchmarking... ''Perl is as fast as C'' but only so long as the inner loops of the program are done as primitives.
<monotonom>
And my point is this. You put in a hundred times more man-hours and you get, what, a puny 2x speedup. Clearly it shows where is the deadend and where is the future.
<jlouis>
value numbering is but a common-subexp elimination, and I would think most compilers did loop invariant code motion
<monotonom>
And Smerdyakov's point makes it even more dramatical.
<Nutssh>
And that speedup might be illusionary. Fast primitives can overcome a slow language.
<jlouis>
but I might be wrong in the Ocaml case
<Nutssh>
jlouis, ocaml does neither.
<Smerdyakov>
jlouis, not true! Haven't you read this Muchnick book that stresses how those are distinct optimizations? :D
<monotonom>
Value number is more powerful than cse, is all I recollect.
<Nutssh>
Look at the assembly code for 'let bar x = x*x*x*x*x' and see 4 detagging instructions.
<Smerdyakov>
monotonom, I think they are incomparable, according to Muchnick.
<monotonom>
Alright, I never paid attention in class when the prof showed the slide describing value numbering.
<jlouis>
well, you will need recursive CSE to catch all cases
<jlouis>
value numbering finds them all in one pass
<Nutssh>
value numbering is distinct from CSE. Its a way to eliminate redundancies, but it won't eg, notice the redundancies of t1 = (x+y)+z; t2 = x+(y+z);
pac_away is now known as pac_
<monotonom>
Oh there is no redundancy in that, if + is floating point addition.
<Nutssh>
If you put exp's into a 'canonical form' of some sort, then value numbering can be used for CSE.
<Nutssh>
Integer.
<monotonom>
Heheh I am teasing.
<jlouis>
Smerdyakov: I am quite interested in his point that CSE and VN are distinct. Appel lists them as I said before
* monotonom
always comes up with pathological cases. Talent of designing the most wicked test cases.
<Nutssh>
Anyways, the problem with value numbering in ocaml is that it uses expressions to represent programs, not n-argument ro= OP r1 ... rn.
<jlouis>
Oh, it doesn't sport an imperative IL?
<jlouis>
(I know about nothing of Ocamls internals)
<Nutssh>
loop invariant code motion can be hacked up by exploiting dead code elimination, redundancey elimination, and the register allocator. copy anything that seems redundant in a loop outside of theloop, then use value numbering to get rid of the redundant computation in the loop. If you made a mistake, dead code elimination gets rid of the extra computation. And register allocator to nicely clean things up.
<Nutssh>
I got the trick from Keith Cooper's optimization class.
<jlouis>
Yes, that will work nicely
<Nutssh>
No, it has an expression-based IL thats similar to an untyped variant of the source langauge, This then gets run through the declosure and tail recursion. (oops! its too late to do loop invariant code motion around tail recursion at this point.)
<jlouis>
Register allocators are nice at doing copy-propagation anyway. Especially with a George-Appel style iterated coalescing algorithm
<Nutssh>
That gets reduced to an expression syntax thats low-level, encoding the detagging operations for instance. That then gets serialized into a pseudoinstruction stream, which runs through the register allocator and instruction selection which spits the final code.
<Nutssh>
But witout an IL of the form rout = OP rin1 rin2 rin3 ... rinn, value numbering isn't going to work well cause you can't notice redundancies and just set one of them to be a register-copy. To make it work, you'd have to add an entire pass to convert it into that form.
<jlouis>
Ah, MLton is easier in this respect for sure
<jlouis>
no tags, SSA-form...
<jlouis>
but you gain something from whole-program compilation that is a bit unfair
<Nutssh>
Nice.. Does it have a type system along the ocaml variant or sml-nj variant?
<jlouis>
It does not produce notably faster code than Ocaml in various shootouts though
<jlouis>
It might fare well for Numeric processing
<jlouis>
I think some of the funnier benchmarks are quite intensive on numerics
<Nutssh>
CRAPS has toy problems. :) What'd matter to me is, say, my analysis of 130M network measurements (done in ocaml)
<mrsolo>
too bad that shootout can't benchmark programmer productivity
<mrsolo>
or benchmark program maintance
<Smerdyakov>
mrsolo, well, LOC is slightly related.
<mrsolo>
loc is not really
<mrsolo>
but we don't have anything better
<Smerdyakov>
OCaml wins if I weight CPU usage and LOC equally. :)
<Smerdyakov>
But I'm sure this is an artifact of poorly coded programs.
<Nutssh>
And toy problems.
<jlouis>
nah, it is an artifact of all CRAPS problems being so highly imperative it hurts
<jlouis>
Nutssh: Getting rid of tags for your integers ought to help
<jlouis>
basic idea is: When you whole-program compile, you can instance out every polymorphic function (monomorphization). Then you are able to instruct the garbage collector directly of pointers and thus, you do not need the tag bit anymore
<jlouis>
opposed to some heavy boxing/coercion analysis usually seen
<jlouis>
followed by tag-bits of course
<Nutssh>
I think I know why itt doesn't do as terrible as I would expect because of that.. Typical ILP for software is low compared to superscalarness of modern CPU's. detagging uses that surplus capacity.
<Nutssh>
It makes me a bit nervous, for one thing, the GC is going to be a lot more complicated in that world.
<jlouis>
IIRC it is not that hard
<Smerdyakov>
Which world?
<Nutssh>
Each block being encoded to indicate what parts are literals and which are pointers to get rid of tagging.
<Smerdyakov>
Why would that be significantly more complicated?
<Nutssh>
Still wish that ocaml had *some* optimization. The compiler's supposed to figure out that trivial things can be pulled out of loops rather than forcing me to do it manually.
<Nutssh>
Make any mistake and the bugs are going to be a nightmare to find.
<mellum>
Does ocaml use SSA internally?
<Nutssh>
No. Ocaml has no optimization other than dead code elimination and copy propagation through the register allocator.
<Nutssh>
scroll up for more details.
<mellum>
Ugh. Then why is it still so fast? ;)
<Nutssh>
also scroll up for my conjecture.
vezenchio has quit ["With little power comes little responsibility"]
<mellum>
nutssh: you mean the one that superscalarity takes care of unoptimized stuff?
Tipsy has quit [Remote closed the connection]
<jlouis>
mellum: CPS and SSA are equivalent for instance.
<jlouis>
it is not that SSA per se gives you optimizations impossible to do without
<Nutssh>
mellum, yes.
<Nutssh>
jlouis, whats the CPS equivalent for PHI?
<jlouis>
PHI?
<mellum>
jlouis: I wouldn't say that./ Some optimizations are nearly imp[ossibly hard without SSA
<Nutssh>
phi-nodes in SSA form.
<Smerdyakov>
Nutssh, parameter binding.
<jlouis>
ah, I am referring to a Kelsey paper
<jlouis>
mellum: sure, and when they equivalent, they are equally simple in CPS ;)
AshW8rk3 has joined #ocaml
<jlouis>
(not true, but hehe)
<Nutssh>
Wouldn't that entail encoding the entire set of open variables in the postdominator set of every instruction as a paramater in the continuation?
<Nutssh>
Scratch that. It wouldn't be quite that bad.
<mellum>
I find CPS conceptually way more complicated than SSA. But maybe that's just because I'm a narrow-minded imperativist.
<Nutssh>
Thats one thing that always caught me up in the class, SSA form was too natural to think about. I'm too used to ML languages to remember 'oh yeah, mutation'.
<jlouis>
Nutssh: I am not sure if MLton does that, but you can always describe by tupling a type tag to your data layout and calling by alloc(type, data)
<jlouis>
(GC-wise)
Riastradh has joined #ocaml
<mrsolo>
so basically ocaml got great potential
<mrsolo>
since lots of things are unoptimized
<jlouis>
Ocaml is well-crafted ;)
<Nutssh>
I think I'd give CPS a pass. Another thing I learned from the class, and hit home looking at adding in optimization to ocaml. Representation matters, a lot.
<mrsolo>
need more modules
<mrsolo>
a lot more
<mrsolo>
it fun to do pet projects
pac_ is now known as pac_aw
<mrsolo>
but writing almost every thing from scratch isn't my cup of tea
<Nutssh>
jlouis, yeah.
<Riastradh>
Is there a log of the conversation I just walked into?
<Nutssh>
I can tail mine and DCC.
avlondono has quit ["Leaving"]
<Nutssh>
Big fat libraries help. :) Java's gotten amazingly far on em.
<mellum>
Maybe we should just write an Ocaml-frontend for gcc, that'd give a lot of optimizations for free :)
<jlouis>
hey hey
<jlouis>
GCC has not even transferred a lot of their optimizations to their new SSA-pass yet
<mrsolo>
Nutssh: java has reach critical mass now. it isn't going away
<Riastradh>
Nutssh, I doubt I can accept DCC.
<mrsolo>
in fact finacial insitutions have just endorsed java so that is that
<mrsolo>
it will replace cobol :-)
<mellum>
jlouis: So? Which onws are missing?
<jlouis>
mellum: almost every fun, basic optimization
<Nutssh>
GCC's planning on removing or greatly simplifying their existing optimization passes as more powerful ssa ones take over. They're in the process of stabalizing their new IL and ssa, so thats not happened yet.
<jlouis>
it is still on their use-def chain implementation
<mellum>
jlouis: I don't think so. It has complete dead code elimination and partial redundancy elimination for example.
<mellum>
jlouis: I don't see anything significant missing.
<Nutssh>
Riastradh, what do you have?
<jlouis>
mellum: GC?
<jlouis>
polymorphic language
<Riastradh>
Nutssh, could you put it up onto a temporary web server or something?
<mellum>
jlouis: Java has GC, C++ has polymorphism. So it's already ther :)
<Nutssh>
One of my political complaints about ocaml is the paucity of the standard library. With luck extlib will become a defacto replacement/enhancement.
<mrsolo>
beside libraries.. ocaml doesn't seem too have tool/construct to support large application development
<mrsolo>
or i am not aware of those yet
<Nutssh>
From a post on the ocaml list, it was said that INRIA wants to maintain control/ownership over the core language compiler, which is why they wouldn't accept enhancements to the standard library.
AshW8rk3 has quit [Remote closed the connection]
<mrsolo>
sound like sun
AshW8rk3 has joined #ocaml
<Nutssh>
mrsolo, what do you mean? And what size development are you talking about? I guess modules aren't enough?
<mrsolo>
just little things
<mrsolo>
like for example eclipse counterpart
<mrsolo>
good documentation standard
<mrsolo>
library repository
<Nutssh>
Java has a really large set of libraries, so its not as noticable.
<mrsolo>
btw how come ocaml doesn't go for hiearchical(sp) namespace/directory mapping like lots of other languages?
<Nutssh>
It does go to heirarchial modules.
<mrsolo>
oh didn't know that :-)
<mrsolo>
and map to directory just like java?
<Nutssh>
No, it doesn't have that, but with clever use of search paths when compiling 'module X = struct module A=A module B=B end' you can sorta get that effect.
<mrsolo>
another little thing like for example, it is fairly easy to hook in unit test code for python/java modules.. don't know how to do that for ocaml yet
<Nutssh>
Another thing is that unlike Cish languages, duplicate definitions are the instant-death that they are in C.
<Nutssh>
''The typechecker eliminates all bugs, whats the nead for testing?'' :)
ionOS has quit ["Using KVIrc 3.0.1 'System Virtue'"]
<mrsolo>
haha
<mrsolo>
funny
<Nutssh>
:) I believe thare's a unit tester 'otest'?
<Nutssh>
google.
<mrsolo>
yes
<mrsolo>
but java, perl, python for example has the language hook if to see if a module is called directly
<mrsolo>
if so, one can trigger test code
<mrsolo>
it's little thing like those make developing large application easier
<Nutssh>
?
<Nutssh>
??
<Nutssh>
What are you asking for?
<mrsolo>
take perl for exampler
<mrsolo>
suppose you have foo.pm there is a function call caller() to see if the module is being called directly from perl inteperter
<mrsolo>
for from other perl script
<mrsolo>
so one can do this
<mrsolo>
if(!caller) { *my test code here *}
<mrsolo>
python has similar construct (__main__)
<mrsolo>
and java basically will call class static main
<mrsolo>
certainly one can just write test code without those language hooks
<mrsolo>
but like i said small things like those make large application development more comfortable
<Nutssh>
Can you wrap a module with another module and have it implement what you want? The module system has great namespace management and flexibility.
<mrsolo>
i can but that is more work :-)
AshW8rk3 has quit [Remote closed the connection]
<mrsolo>
ocaml is pretty good on design for small
<mrsolo>
good language construct, interperter to test out ideas
<mrsolo>
need to work on design for large, that is all
<Nutssh>
I'm not sure what all you want. Namespace management means you can interpose very easily, anywhere, as simple as 'module Foo=TestFoo' at the top of a line lets you completely change where 'Foo.func a b' are going to.
<mrsolo>
well namespace isn't the issue just like you pointed out that was due to my lack of understanding
<Nutssh>
It may be a solution.
<Smerdyakov>
mrsolo, what is the issue, then?
<mrsolo>
no issue, just ocmment and questions
<Smerdyakov>
mrsolo, so you aren't currently thinking of some way in which you think OCaml is less suited to large development projects than one of the other languages you mentioned?
<mrsolo>
#1 how do on construct a project ocaml project layout that each module has tighly couple test codes.. is there a ocaml langauge syntax support that?
<Smerdyakov>
Why is language support for that beneficial?
<mrsolo>
is there a language support for module inspection like pythong _doc_?
<mrsolo>
because it is easier to do builds
<mrsolo>
just call module directly
<mrsolo>
will triiger the test code
<Smerdyakov>
What is "just call module directly"?
<Nutssh>
mrsolo, a lot depends on discipline. You can buildl a disciplin on top of ocaml.
<mrsolo>
and that build script is pretty generalized
<mrsolo>
s/is/can be/
<Smerdyakov>
mrsolo, you mean you want every module to have a special procedure that runs some tests?
<mrsolo>
instead of complicate build action of 'oh to do build testing i need to do XXX XXX'
<mrsolo>
Smerdyakov: no i mean have a language support that it universally place a test code in associate with a module
<jlouis>
That is just a b*llsh*t argument. You do not need that for doing development of big projects...
<Nutssh>
If it automated and straightforward,..
<mrsolo>
yes you do for continously development
<mrsolo>
Nutssh: however module wrapper for test code is never straightforward
<Nutssh>
mrsolo, it seems you have a style complaint. What you want is probably doable, just not necessarily in exactly the style you want.
<Smerdyakov>
mrsolo, I don't agree that that is useful.
* mrsolo
shrugs
<Smerdyakov>
mrsolo, tests won't always make sense as being associated with single modules, and you can easily just create a set of unassociated tests.
<Nutssh>
mrsolo, it can be.. If you're being a good boy and have signatures on every module, would the signatures not enforce wrapper correctness?
<Smerdyakov>
This test-centric development tends to be most popular with users of languages that make very few static guarantees.
<Smerdyakov>
I think it's of very limited value for ML.
<mrsolo>
static guarantees can't solve everything
<mrsolo>
it is ture that test cases set will be a lot smaller
<Smerdyakov>
I've never written a unit test and my life and done fine by it.
<Smerdyakov>
s/and my/in my
<Nutssh>
Smerdyakov: hey.. thats not good logic. saying 'you don't want that' when someone wants something isn't the most convincing. Better to point out an alternative.
<mrsolo>
Nutssh: yes that can solve the issue , we do that for C/C++
<mrsolo>
just not as *nice* :-)
<Nutssh>
Interpose upon callers? I'm not sure what you want. a book ''how to be a disciplined ocaml programmer''?
<mrsolo>
regardling to __doc__? it is simple but effective documentation system for python
<mrsolo>
all one has to do is to load up the module in the inteperter do print __doc__ to figure out how the module works
* mrsolo
shrugs
<mrsolo>
but python is famous for that, the original language vision is low entry cost
<smkl>
what is the difference with that and just having a module with field "doc" or something?
<mrsolo>
nothing
<mrsolo>
except python makes it a standard
<mrsolo>
so generalized tool can be designed against that
<Nutssh>
IE, its a convention. :)
<mrsolo>
exactly
<mrsolo>
so one can write a ocaml specific editor for example to display doc string on the side etc
<mrsolo>
while calling test codes in the backgorund continously..
<Nutssh>
Thats the thing about conventions, there are so many of them... Now what would one use for multilingual docs? Seperate variable for each language? All glued in one variable? :)
<mrsolo>
sure
<mrsolo>
hard problem is left for language developer to solve :-)
<mrsolo>
but having just a little convention build in goes a long way for ease of development
<Nutssh>
Not really. Its a convention. Ocaml already has a convention for docs, (** *) comments.
<mrsolo>
sames goes for perl documentation standard
<mrsolo>
but personally i prefer language wide standard
<Smerdyakov>
It's unfair to compare to Perl in this regard.
<Smerdyakov>
Documentation is almost never needed for OCaml code.
<mrsolo>
why is that? perl pod is pretty much standard
<mrsolo>
documentation is always needed.. as minium, it serves as training material
<Smerdyakov>
OCaml types serve almost all documentation needs.
<Smerdyakov>
Sure, there are other data that must be expressed about code, but one needs to consult them much less frequently.
<Smerdyakov>
I'm talking about interface, not implementation, documentation here, BTW.
<whee>
OCaml code needs documentation just as much as any other language; types don't describe behavior or how to use things
<Smerdyakov>
whee, not true. Sometimes types even determine behavior exactly.
<whee>
there's just no way to describe all behavior in the types
<Nutssh>
Smerdyakov: bullshit. :) I'm going to be doing CGI programming in ocaml in a few days and I see the complete lack of docs for netstrings and am going 'ewww'. The only way I see it working is by taking an existing example code and hoping I can modify it.
<Smerdyakov>
whee, you can describe the most relevant aspects of behavior in types.
<monotonom>
All documentations are useful.
<Smerdyakov>
The critical thing to keep in mind here is the difference between documentation you read to introduce yourself to a library and the documentation you want to have on hand as you are writing code.
<monotonom>
Where can I find netstring docs?
<Smerdyakov>
mrsolo talks about Perl editors displaying docstrings as you go, and I'm saying that, in the majority of cases, the information in those docstrings that the Perl programmer is looking for show up as types in (well-designed) equivalent ML code.
<monotonom>
(So I can judge if it is that bad.)
<Smerdyakov>
I am making an argument based _critically_ on the frequency with which the programmer wants certain kinds of information.
<Nutssh>
Err, ocamlnet.
<Smerdyakov>
Abstract types are an important component here. ML code that doesn't make appropriate use of them can't have these properties, generally.
<Smerdyakov>
Have I semi-convinced the naysayers?
<monotonom>
Haha the opening sentences of the ocamlnet home page are funny
<monotonom>
(The sourceforge one)
<Nutssh>
ocamlnet 96.1, full of details. but I just wnat to know how to get a CGI request in, and where to obtain the paramaters. I think I'llmanage with the example code.
<Smerdyakov>
I am specificlly addressing mrsolo, whee, Nutssh, and monotonom.
<monotonom>
Nay, I am not a naysayer.
<mrsolo>
what you said specifically is true
<whee>
Smerdyakov: I agree with you, I've just misread what you were talking about in the first place
<mrsolo>
but for people who initially exposed to a particular module, type system alone is not sufficient
<Smerdyakov>
mrsolo, it is for me.
<Smerdyakov>
mrsolo, in a vast majority of cases.
<Smerdyakov>
(of well-designed cases)
<mrsolo>
since more often or not, same people often aren't familiar with the knowledge domain in the first place
<mrsolo>
even simple usage example that can be accessed easily helps a long way
<monotonom>
ocamlnet.sourceforge.net takes forever to connect :(
<Smerdyakov>
Sure. I don't think you need any special conventions for introductory documentation, though.
<Nutssh>
It depends on the module and how its designed.
<Smerdyakov>
You are giving a holistic overview, so it's not even clear how you would break it up into bits attached to language entities.
<monotonom>
All documentations are useful.
<Smerdyakov>
Non-type based documentation in OCaml is relatively useless.
<Smerdyakov>
Based on frequency with which it will be used productively
<Nutssh>
That depends on the library and how it is tied together. If you already understand the functionality and are just looking up the right function... thats distinct from, say, tying into a general cgi-session-management codebase with a half dozen modules.
<monotonom>
I think netstring_prce's ocamldoc are well and fine.
<smkl>
is this useful: val to_string : t -> string (* Converts an element of type t to a string. Parameter: value that is converted to a string. Return value: The string that the parameter is converted to. *)
<Nutssh>
And the CGI ones?
<monotonom>
smkl: no
<smkl>
my javadoc comments are always like that
<monotonom>
But Object.toString() in Java is almost cultural.
mij has joined #ocaml
<monotonom>
A few of the netcgi_* docs look at least best-effort to me.
<monotonom>
Some examples or patterns of composing the components are all we need to touch it up.
<monotonom>
Even then, some intended compositions can almost be guessed easily because the types are checked and the functions are almost pure.
<monotonom>
I mean, suppose all the subprograms depend heavily on hidden global states. They all look like "void p()", "void q()", "void r()". You don't even know which order of calling them is correct.
<monotonom>
On the other hand, in a functional paradigm, you will see "p::A->B", "q::X->A", "r::B->Y", and it becomes obvious.
<Nutssh>
Yup...
<Nutssh>
Actually while I'm here.. I have a question, why do most of the libraries I see out there use variant types `Foo and almost never use sum types Foo. ocamlnet being one example.
<monotonom>
Of course the real situations are less ideal, but you still have some handles for educated guesses.
<monotonom>
Perhaps "I may extend it in the future" is on their mind.
<Nutssh>
Yeah. I'll make due, but I was replying to the claim that types are usually almost all you need.
<Nutssh>
Yup. They had a bunch of plans... 3 years ago.
<monotonom>
Ten years ago I watched over the way my classmates learned to use library functions in C.
<monotonom>
The C novice would want to concatenate two strings. He would locate a function "strcat(char *result, const char *s1, const char *s2)". He would then use it thusly: "char *myresult; strcat(myresult, "first", "second");"
<monotonom>
You see the problems? There are two, the superficial one and the real one.
<monotonom>
The superficial one is this. A C guru would of course cry: You fscking idiot! Read the doc! The doc says you must allocate space yourself!
<monotonom>
The real one is this. With a properly designed language such as OCaml, the novice's "naive" idea of "you want a char*? you get it" is actually right-on.
<mrsolo>
there is one more, some piece of information that saying that starcat is what will solve his problem
<monotonom>
Yes absolutely. We assume that everyone reads at least the first paragraph of the doc.
<monotonom>
The trouble is that if the language has problems, the doc will have fine prints on subtleties, and nobody is going to read that.
<mrsolo>
basically that becomes most important when module set get pretty large
<mrsolo>
how fast can a developer search and learn a module for his/her need
<mrsolo>
and how fast he/she can relearn it again
<smkl>
the actual declaration is char *strcat(char *dest, const char *src);
<monotonom>
You see I have ditched C for a long time. :)
<monotonom>
It was actually strcpy. The novice wanted to save a copy of a string. The novice wrote "char *newcopy; strcpy(newcopy, "hello");"
<smkl>
there is no way it could set newcopy to a new string reference, so it should be possible to figure out how it works from the declaration
bk_ has joined #ocaml
jdrake has joined #ocaml
whee has quit []
buggs^z has joined #ocaml
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
buggs has quit [Read error: 60 (Operation timed out)]
Nutssh has quit [Read error: 110 (Connection timed out)]
KrispyKringle has quit [Remote closed the connection]