From -768622198999563871
X-Google-Thread: f78e5,e8e0ab29e8861265
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: hattons@globalsymmetry.com ("Steven T. Hatton")
Newsgroups: comp.std.c++
Subject: Re: If C++ had interfaces, what would they be?
Date: Thu, 21 Jul 2005 15:42:51 GMT
Lines: 75
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <zoedneshNsJQcEPfRVn-qg@speakeasy.net>
References: <dfadnU0KIovHJkbfRVn-3Q@speakeasy.net> <GTADe.1387$Fk4.837@newssvr21.news.prodigy.com>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Trace: news.demon.co.uk 1121960576 14054 158.152.254.254 (21 Jul 2005 15:42:56 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 21 Jul 2005 15:42:56 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: KNode/0.9.1
X-DMCA-Complaints-To: abuse@speakeasy.net
X-Greylisting: NO DELAY (Relay+Sender autoqualified);
	processed by UCSD_GL-v1.3 on mailbox8.ucsd.edu;
	Wed, 20 July 2005 17:38:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j6LFgpgZ003711;
	Fri, 22 Jul 2005 01:42:51 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-NNTP-Posting-Date: Wed, 20 Jul 2005 19:35:25 -0500
X-Delivered-To: std-c++@ucar.edu
X-TN-Interface: 209.99.127.20
X-Spamscanner: mailbox8.ucsd.edu  (v1.6 Apr  6 2005 07:48:50, 0.0/5.0 3.0.0)
X-Postfilter: 1.3.32
X-Authentication-Warning: serv1.gc.dca.giganews.com: news set sender to poster@giganews.com using -f
X-Newsgroups: comp.std.c++
X-MailScanner: PASSED (v1.2.8 21790 j6L0ZRW6036438 mailbox8.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:1433

Gene Bushuyev wrote:

> "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.

 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15815

> 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

It seems to me we are simply asking the computer (C++PP?) to automate the
steps the programmer has traditionally performed by hand with #include
directives.  Would simply giving the `interface' the same functionallity we
get from "#include guards" suffice?  The notion of doing that with a
preprocessor bothers me bacause `interface' not a preprocessor directive in
your example. Doing it with the compiler would probably entail a new way of
viewing what a compiler does.  I'll need to think on this somemore.
-- 
STH
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org

---
[ 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                       ]



