Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] (Sorry for my last post) lazyness, exceptions?, ocaml syntax rule-of-thumbs
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Kontra, Gergely <kgergely@m...>
Subject: Re: [Caml-list] (Sorry for my last post) lazyness, exceptions?, ocaml syntax rule-of-thumbs
>>   > One point was ocaml is really obscure is the file reading: it needed to
>>   > wrap the line-reading in an infinite loop, and this loop is ended via an
>>   > exception. I think End_of_file is not an exception, it is just an event.
>What next ? int_of_string "foo" returning None ?
No, that wouldn't be a good idea.
But writing int_of_string "foo" is a bad thing, while the end-of-file
thing is not a design problem. Is there a function to test eof? (without
consuming a line?)

>If you want to read a whole file as a string, you can use the
>following function:
Well, but what about memory usage?
I just miss an iterator, or sg. like that, which reads a line, processes
it, reads next line...
Just want to write cleaner, which eg. in ruby is just (so intuitive)

IO.foreach("filename.ext") {|line|
	# process line

and don't like infinite loops.


+-[Kontra, Gergely @ Budapest University of Technology and Economics]-+
|         Email:,          |
|  URL:    Mobile: (+36 20) 356 9656     |
+-------"Olyan langesz vagyok, hogy poroltoval kellene jarnom!"-------+
Magyar php mirror es magyar php dokumentacio:

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: