guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ STL


From: Brett Viren
Subject: Re: C++ STL
Date: Mon, 24 Jun 2002 15:56:59 -0400

Eric E Moore writes:
 > The way that variable access works in scheme means that iterators and
 > much of the rest of the STL aren't especially needed.

Also, the compile-time type safty of C++ templates is a mismatch with
scheme's run time version, so accessing STL templates from scheme
wouldn't work so well, I guess.  You could come up with new types in
scheme and would have to recompile your STL interface library to use
them.

However, going the other way, an STL based wrapper for Scheme could be
useful.  For example, if MyClass was a C++ class which had a
corresponding GOOPs class "my-class", then it would be cool to be able
to do things like:

list<MyClass> mcl 
  = 
scm_to_list<MyClass*>(gh_eval_str("(some-func-returning-list-of-my-class)"));

And, 

MyClass* mc 
  = dynamic_cast<MyClass*>(gh_eval_str("(some-func-returning-my-class)"));

 > It might be worth generalizing some of the functions, but most
 > schemers tend to use the list-based ones most of the time, which are
 > quite good.

In fact, the more I learn "modern" C++, as typified in Stroustrup's
3rd Ed., the more scheme-like it seems.  Particularly in the area of
binders, functors, etc.

It almost even has lambda via functions like mem_fun<>() or with via
slots from libsigc++.

What C++ drastically lacks, imo, however is reflection.

Anyways,
-Brett.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]