From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 42A44BBD5 for ; Wed, 4 Mar 2009 17:35:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsBAEg8rknRVdqpjWdsb2JhbACUQz8BAQEBCQkKCQ8FsxKQIwEDAQOEBQaFBQ X-IronPort-AV: E=Sophos;i="4.38,301,1233529200"; d="scan'208";a="23859192" Received: from mail-bw0-f169.google.com ([209.85.218.169]) by mail3-smtp-sop.national.inria.fr with ESMTP; 04 Mar 2009 17:35:56 +0100 Received: by bwz17 with SMTP id 17so3608502bwz.27 for ; Wed, 04 Mar 2009 08:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=Nx9GiNzkikFd+lJHtufnIe8EyoIHnWh2Xt5QgU8XzKk=; b=HkrtxuXqn3VPp/0C7KrWEBq6W7EFz8l6JnQp9BRD64iLeeM5T4rU5lkgjDPsFWaBqu IfX1S4DtjQXCuLJtvA3dqhFBCQ8k6FZ4CXnugZ3hvhafwNvgjP6yxtq3NTTwQCgaBCLZ MoZBF45wt/4WSg3A9VnkugWdLCHNHSHkE84dg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=JyYEJlb2RVh4sUeNoPkcAhj5GkfLZDrgo+c1UDX/uI9kdHp2zq/WDMj/mANxnVQ7Ok vphtnYySFKmOn+N1GO9/xM6uWZruWOvRPLe/09dlFhbvUXtl7ZRUEb6es/IDvH7uj+yN CSvGIf5psRjnNNq5bIIO+k6lJnM9Np992qLlQ= MIME-Version: 1.0 Sender: mikkelfj@gmail.com Received: by 10.181.149.19 with SMTP id b19mr20466bko.67.1236184556438; Wed, 04 Mar 2009 08:35:56 -0800 (PST) In-Reply-To: <91a2ba3e0903031340wcdc976cp52522eb35f7ccb73@mail.gmail.com> References: <91a2ba3e0903031340wcdc976cp52522eb35f7ccb73@mail.gmail.com> Date: Wed, 4 Mar 2009 17:35:56 +0100 X-Google-Sender-Auth: 4480ec9f84b5ad7c Message-ID: Subject: Re: [Caml-list] stl? From: =?UTF-8?Q?Mikkel_Fahn=C3=B8e_J=C3=B8rgensen?= To: Raoul Duke Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; stl:01 mikkel:01 rgensen:01 mikkel:01 polymorphism:01 stl:01 stepanov:01 iirc:01 o'caml:01 stepanov:01 ocaml:01 functors:01 ocaml:01 2009:98 duck:98 2009/3/3 Raoul Duke : > hi, > > the caml archives show discussion around C++ polymorphism wrt STL > (since Stepanov iirc said that C++ was the only language which > supported what he needed to let him implement his generic programming) > but i didn't yet see anywhere a concrete implementation or mapping > from C++ STL to O'Caml. As I recall, Stepanov did originally work containers in Lisp or similar, but realized this would never help "real world" programmers. The C++ template is far more powerful than originally anticipated and Stepanov took advantage of that. Clearly, the choice of C++ has affected the design of STL, so it would be pointless to try to port STL directly to OCaml. In fact, I think that OCamls basic Array, List, containers and polymorphic algorithms does exactly what Stepanov intended to do, without having to introduce Functors or other overhead. However, OCaml could do with a more precisely defined container duck typing interface (not an interface just convention) which I think will happen with Batteries. I think perhaps OCaml could have a library of algorithms that are not specific to one container type, but again that requires better duck typed containers, and perhaps it is just better and more efficient to implement the most important operations for each container type instead of trying to generalized the entire world. Scripting languages were not so hot at the time, short of Perl, but Ruby would easily fit well into the STL idea, just like Lisp also did. There was a discussion by STL insiders about wether algorithms (simple example is the min function) should be template parameterized. They ended up not having explicit type arguments because this was much simpler to work with. Containers (like vector) have type arguments because they were necessary in C++. As to whether STL is well designed or not, fast or not, I think STL at the time solved a great problem. Of course you could do something faster, but often a map or set would be just what needed, just like OCamls current Map and Set is usually good enough. Mikkel