additions to standard library?

From: Thorsten Ohl (ohl@hep.tu-darmstadt.de)
Date: Thu Mar 09 2000 - 14:18:23 MET

  • Next message: Xavier Leroy: "Re: Interfacing C"

    Markus Mottl <mottl@miss.wu-wien.ac.at> writes:

    > Hello, it sometimes happens that I need functions on abstract data
                ^^^^^^^^^ often :-)
    > types in the standard library which are not available there, but
    > could be considered as "usual" operations on such data.

    > Some specific examples include, e.g.:

    My favorites are Map and List, of which I keep carrying around
    turbocharged versions.

    > CVS-repository [...] "peer review"

    That's a brilliant idea!

    Here's another issue in the same problem domain, that might be more
    interesting for developers: wouldn't it be possible to add a language
    feature that allows to extend module implementations without opening
    the pandora box of classes with inheritance?

    Currently, we can use `include' to extend module types, but not
    implementations. I'm thinking of something like

        module type ThoList =
          sig
                include List (* doesn't work because list.mli is a file,
                             but you get the idea :-) *)
                val flatmap : ('a -> 'b list) -> 'a list -> 'b list
          end
        
        module ThoList : ThoList=
          sig
                include List
                let rec flatmap f = function
                  | [] -> []
                  | x :: rest -> f x @ flatmap f rest
          end
     
    Cheers,
    -Thorsten

    -- 
    Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
    http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]
    



    This archive was generated by hypermail 2b29 : Fri Mar 10 2000 - 09:13:52 MET