On Mon, Jun 28, 2004 at 03:33:56PM +0300, Jere Sanisalo wrote:
> Hi,
>
> just a few thoughts on adding new modules to extlib. One useful feature
> would be a module that offers different kinds of iterators on number ranges.
> I've found myself writing some nasty for loops and I've been thinking that
> wouldn't it be useful is there was something like List.iter for a number
> range. Attached is a blanket base where to build more iterators (like
> floating point iterators with a given step or multidimenstional iterators).
I like the iterators.
One gripe I have about them (and indeed about the List.iter and
List.map functions built into the library) is that the parameter order
is just plain wrong! It's much clearer to write:
List.iter list (fun elem ->
very long function definition
...)
instead of:
List.iter (fun elem ->
very long function definition
...) list
Because what you're iterating over ('list') gets lost in the second
version.
Why can't we also iterate over floats? I consider it a problem in
OCaml that there is no for ... construct for floats.
> Also coming from a C++ background, I've found the lack of a scope finalizera
> bit disappointing. It would be nice to have a function such as this in
> extlib:
Normally this function is called 'finally'. Is this function already
in ExtLib? A quick grep over my version shows that it is not. There
is a rather convoluted version of finally defined at the end of this
file:
http://www.fungible.com/stream_fixed.ml
Of course what would be really great (and probably not possible) would
be to have a way to run a finalizer when a variable goes out of scope.
This would allow us to create, eg., file descriptor objects which
automatically close the underlying file descriptor at the earliest
opportunity.
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MAKE+ is a sane replacement for GNU autoconf/automake. One script compiles,
RPMs, pkgs etc. Linux, BSD, Solaris. http://www.annexia.org/freeware/makeplus/
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|