From 7615931473884442442
X-Google-Thread: f78e5,e8e0ab29e8861265
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!tsicnews.teliasonera.com!newsfeed00.sul.t-online.de!t-online.de!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: spam@smapguard.com ("Gene Bushuyev")
Newsgroups: comp.std.c++
Subject: Re: If C++ had interfaces, what would they be?
Date: Wed, 20 Jul 2005 23:20:01 GMT
Organization: SBC http://yahoo.sbc.com
Lines: 55
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <GTADe.1387$Fk4.837@newssvr21.news.prodigy.com>
References: <dfadnU0KIovHJkbfRVn-3Q@speakeasy.net>
NNTP-Posting-Host: news.news.demon.net
X-Trace: news.demon.co.uk 1121901610 25071 158.152.254.254 (20 Jul 2005 23:20:10 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 20 Jul 2005 23:20:10 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-MSMail-Priority: Normal
X-UserInfo1: OPXWBWFOE@BS@^LYMRKNOPDA[X_LPO@FKY\@LWQHBATBTSUBYFWEAE[YJLYPIWKHTFCMZKVMB^[Z^DOBRVVMOSPFHNSYXVDIE@X\BUC@GTSX@DL^GKFFHQCCE\G[JJBMYDYIJCZM@AY]GNGPJD]YNNW\GSX^GSCKHA[]@CCB\[@LATPD\L@J\\PF]VR[QPJN
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j6KNK1sE017006;
	Thu, 21 Jul 2005 09:20:01 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Wed, 20 Jul 2005 19:12:38 EDT
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1428

"Steven T. Hatton" <hattons@globalsymmetry.com> wrote in message 
news:dfadnU0KIovHJkbfRVn-3Q@speakeasy.net...
> In TC++PL(SE) there are many different constructs given the designation of
> "interface".  I'm confident that opinions vary as to what /does/ 
> constitute
> an interface.  I'm also confident that the term can be meaningfully 
> applied
> to many different aspects of a program with significant diversity in
> connotation.
>

Look at gcc extensions (#pragma interface/implementation) 
http://gcc.gnu.org/onlinedocs/gcc-3.4.0/gcc/C---Interface.html for one 
example.
I would rather prefer interface/implementation keywords, which would create 
a namespace and all the namespace rules be also applied to 
interface/implementation blocks.

interface foo
{
    void f();
    void g() { ... } // implemented in interface: same as "inline void g()"
    template<class T> void h(); // it's ok to have implementation even in 
another file
    // because compiler knows that implementation name is the same as 
interface name
}

implementation foo
{
    void f() { ... }
    template<class T> void h() {...}     // template implementation
}

in another file:
implementation bar
{
    using interface foo;
    void g() { f(); } // or foo::f()
}

It requires more smarts from the compiler to know where to find interfaces 
and include them only once and where to find implementations and compile 
them also once and include template implementation with interface, etc. 
There are probably some other complications with this scheme that I haven't 
thought about, but on the surface it looks feasible.

- gene 

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



