From -2958015444595381691
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,bed6baff9e441d5c
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-02-05 16:52:07 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news-peer.gip.net!news.gsl.net!gip.net!opentransit.net!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: dlagno@mail.nnov.ru (Denis Lagno)
Newsgroups: comp.std.c++
Subject: Re: proposal: "virtual restrict" inheritance
Date: Thu, 6 Feb 2003 00:52:05 +0000 (UTC)
Organization: http://groups.google.com/
Lines: 111
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <5a0f3464.0302031509.465980e3@posting.google.com>
References: <5a0f3464.0302020455.25d887a9@posting.google.com> <5a0f3464.0302030047.64f63c34@posting.google.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1044492725 4156 10.0.0.1 (6 Feb 2003 00:52:05 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 6 Feb 2003 00:52:05 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18gaGn-00014l-00
	for mail2news@news.news.demon.net; Thu, 06 Feb 2003 00:52:03 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id LAA18695; Thu, 6 Feb 2003 11:51:57 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: 3 Feb 2003 23:09:45 GMT
X-Spam-Status: No, hits=-5.5 required=5.0
	tests=GAPPY_TEXT,NOSPAM_INC,REFERENCES,SPAM_PHRASE_01_02
	version=2.41
Xref: archiver1.google.com comp.std.c++:17801

In more formal words.

beginning of [class.derived] clause now states:

###
1 A  list  of  base classes can be specified in a class definition
using
  the notation:
            base-clause:
                    : base-specifier-list
            base-specifier-list:
                    base-specifier
                    base-specifier-list , base-specifier
            base-specifier:
                    ::opt nested-name-specifieropt class-name
                    virtual access-specifieropt ::opt
nested-name-specifieropt class-name
                    access-specifier virtualopt ::opt
nested-name-specifieropt class-name
            access-specifier:
                    private
                    protected
                    public
###

It should be changed to:

###
1 A  list  of  base classes can be specified in a class definition
using
  the notation:
            base-clause:
                    : base-specifier-list
            base-specifier-list:
                    base-specifier
                    base-specifier-list , base-specifier
            base-specifier:
                    ::opt nested-name-specifieropt class-name
                    virtual ::opt nested-name-specifieropt class-name
                    access-specifier ::opt nested-name-specifieropt
class-name
                    restrict ::opt nested-name-specifieropt class-name
                    virtual access-specifier restrictopt ::opt
nested-name-specifieropt class-name
                    virtual restrict access-specifieropt ::opt
nested-name-specifieropt class-name
                    access-specifier virtual restrictopt ::opt
nested-name-specifieropt class-name
                    access-specifier restrict virtualopt ::opt
nested-name-specifieropt class-name
                    restrict access-specifier virtualopt ::opt
nested-name-specifieropt class-name
                    restrict virtual access-specifieropt ::opt
nested-name-specifieropt class-name
            access-specifier:
                    private
                    protected
                    public
###

As well we should add subclause [class.restrict].
(in following text w.r.t. = with respect to)

###
  10.x  Restricted inheritance                               
[class.restrict]

1 A base class specifier that contains the keyword restrict, specifies
  a restricted base class.  We say that a class without base classes
is not
  restricted w.r.t. any class.  A class with direct restricted base
class R
  is restricted via R w.r.t. R and all base classes of R.  A class
with direct base
  class B is restricted via B w.r.t. all classes which B is restricted
w.r.t.
  A class X is restricted w.r.t. to class A if class X is restricted
  via some class w.r.t class A.

2 A program in which some fixed class X is restricted via more than
one class
  w.r.t. some fixed class B, is ill-formed.
  [Example:
          class A1 { /* ... /* };
          class A2 { /* ... /* };
          class B1: A1 { /* ... /* };
          class B2: A2 { /* ... /* };
          class C: A1, A2 { /* ... /* };
          class D1: B1, C { /* ... /* };
          class D2: restrict B2, C { /* ... /* };
          class E1: restrict D1 { /* ... /* };
          class E2: D2 { /* ... /* };
          class F: E1, E2 { /* ... /* };
  Here F is restricted via E1 w.r.t. D1, B1, C, A1 and A2.  F also is
restricted
  via E2 w.r.t. B2 and A2.  Hence this program is ill-formed.  --end
example]
###

OK, what problems does it solve??
(1) it enables optimisation of virtual inheritance that cannot be done
if compiler sees only 1 translation unit.
(2) problem raised by Daniel Gutson -- how implement exclusive
inheritance.

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



