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=1.7 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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 2C592BBC4 for ; Tue, 3 Mar 2009 23:42:19 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiMCANZArUnRVduukWdsb2JhbACMaIdAPwEBAQEJCQwHD7E8gQePfQEDAQOEAwY X-IronPort-AV: E=Sophos;i="4.38,297,1233529200"; d="scan'208";a="36049456" Received: from mail-ew0-f174.google.com ([209.85.219.174]) by mail4-smtp-sop.national.inria.fr with ESMTP; 03 Mar 2009 23:42:18 +0100 Received: by ewy22 with SMTP id 22so2563455ewy.27 for ; Tue, 03 Mar 2009 14:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=IX/pgI4VRjNGUkuW7l2lG2mkNaLuhoOhsSe8KqPDznM=; b=lb5c6v/XOxQMD2k0bF57ep2xq2o+ITfgDl2O7stMi5G9Kq7LKxcqI0lmGmyXlW1rR/ K38Upo3HPu0onXsLa1lNoK5FFIPLfyJdrkKzYZOTMYXyOno2BjVai9U2qIdDtDrz6hnF N/Rr93d9s/yYHKU4Fk5TVCLM+G5FnRZxB6T5o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=B3cD+gxef3L/++fD+rQlLTUtiqZCLgW+OJc6U3zzYeFovQVy9Ot0JL8eGWaSQjfH2J OrqkPosFPZ8GZ3VoNiswm6zKHMmFq4B2xhrqN3RzGF0xGGkbY9eGH1uWUs9dpd9YvU4G LR0r7agxTk+lC75cnk2aByTrzMUsFY7SyyP8E= MIME-Version: 1.0 Received: by 10.210.126.18 with SMTP id y18mr290929ebc.69.1236120137791; Tue, 03 Mar 2009 14:42:17 -0800 (PST) In-Reply-To: <87zlg2z19g.fsf@aryx.cs.uiuc.edu> References: <91a2ba3e0903031340wcdc976cp52522eb35f7ccb73@mail.gmail.com> <87zlg2z19g.fsf@aryx.cs.uiuc.edu> Date: Tue, 3 Mar 2009 17:42:17 -0500 Message-ID: <9d3ec8300903031442j7280161ejb8d2f22bf3259351@mail.gmail.com> Subject: Re: [Caml-list] stl? From: Till Varoquaux To: Yoann Padioleau Cc: Raoul Duke , caml-list@yquem.inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; stl:01 ocaml's:01 integers:01 inlined:01 unboxed:01 polymorphism:01 stl:01 stepanov:01 iirc:01 o'caml:01 stepanov:01 unboxed:01 ocaml:01 'int:01 integers:01 ocaml's integers are never 'boxed'.... but you are right values contained in blocks don't generally get inlined (there's a known caveat for float who end up with the dual representation (aka boxed/unboxed)). Till On Tue, Mar 3, 2009 at 5:31 PM, Yoann Padioleau wrote: > Raoul Duke writes: > >> 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. >> >> i'm just trying to get my head around what it might look like, and >> if/how it might be useful. (it just bugs me that somebody can claim >> that C++ is the /only/ language that could do it -- maybe the real >> quote implied "mainstream" or something. apparently Ada wasn't up to >> snuff http://www.sgi.com/tech/stl/drdobbs-interview.html) > > I don't know what are the Stepanov requirements, but C++ > can do unboxed collections like =C2=A0list, which OCaml can > not provide I think. a 'int list' has boxed integers in OCaml. > > Also, a maybe good thing with STL is that you can write a single 'find' > or 'sort' function that will work for every kind of collections > (list, arrays, map, hash, etc) by using the > indirect iterator idiom, without the penalty of dynamic dispatch > solutions. I am not sure OCaml can do that too. > > The question is do we really need those 2 things ? > I've worked a little bit with C++ using unboxed objects, that > is without introducing pointers (similar to boxing) in templates, > like list
instead of list, and passing them > as value in parameters, or returning them, > and it was far less efficient because there was lots of copy, > and you could not use then virtual method on them. So in the > end the C++ programmer I thing manually re-introduce boxing > when using STL if he wants good performance, and he can not really > rely either on the default copy/equal implementation provided > by those templates. So, yes STL makes it possible to do things, > but programmers don't want them, or only in very few cases where > one need extreme performance. > > > > >> >> sincerely. >> >> _______________________________________________ >> Caml-list mailing list. Subscription management: >> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >> Archives: http://caml.inria.fr >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >