Browse thread
stl?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Till Varoquaux <till.varoquaux@g...> |
| Subject: | Re: [Caml-list] stl? |
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 <padator@wanadoo.fr> wrote: > Raoul Duke <raould@gmail.com> 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  list<int>, 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<figure> instead of list<figure*>, 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 >