220 10593 <20140509221552.GA32099@sara.home> article
Path: news.gmane.org!not-for-mail
From: Magnus Fromreide <magfr@lysator.liu.se>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Forward declaring names
Date: Sat, 10 May 2014 00:15:52 +0200
Lines: 57
Approved: news@gmane.org
Message-ID: <20140509221552.GA32099@sara.home>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: ger.gmane.org 1399673765 22440 80.91.229.3 (9 May 2014 22:16:05 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 9 May 2014 22:16:05 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDELLREETMBRBG5HWWNQKGQED7H5JZQ@isocpp.org Sat May 10 00:15:58 2014
Return-path: <std-proposals+bncBDELLREETMBRBG5HWWNQKGQED7H5JZQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ee0-f69.google.com ([74.125.83.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDELLREETMBRBG5HWWNQKGQED7H5JZQ@isocpp.org>)
	id 1Wit5A-0001XM-9a
	for gclcip-std-proposals@m.gmane.org; Sat, 10 May 2014 00:15:56 +0200
Original-Received: by mail-ee0-f69.google.com with SMTP id e51sf2841234eek.8
        for <gclcip-std-proposals@m.gmane.org>; Fri, 09 May 2014 15:15:56 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
         :mime-version:user-agent:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe:content-type:content-disposition;
        bh=uASEYokwA6W920qJUjUPV/CR49BU/yJVcerlzuOXzSk=;
        b=hbEzEvmjg+06hr4VzlzY7HoL+zi5uOkMmnOzxFZD3xHjw31xFl6Q1yzR37vL4d0puu
         nS8R+e8/BHJt9mV6fq+ZWbXcjo997HwAdp0AsibpfUdA2mfcc1RDwO6NWKBr6YOwejT+
         flRkXILj53wdkljcEZut/3Ak/dCUZ8CjEW9cuqVz+4iubQUpZg7q2h78OYLB/ibCeuIR
         80LCDTXLjGfl/CXyEXfObouBW5cZiYDtPMCzrdtn8SERZF+kV9j0MdEIYJM2Z/ttN5Tq
         P+FOLKCdwVVWuT13dQ2bT2oRXcSXH3gPlKZ4xp/uRF6X7FmfHyM+K8Hr+7GQvSy0VW6c
         FlMA==
X-Gm-Message-State: ALoCoQmywAyoRXLSjE7OqN366CgQZqTrtLhIZMZf6EwCSvILGKEE4QvEL3sWzuLKTTbvBf6U6WcV
X-Received: by 10.180.206.33 with SMTP id ll1mr684235wic.5.1399673755988;
        Fri, 09 May 2014 15:15:55 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.19.74 with SMTP id c10ls58948lae.2.gmail; Fri, 09 May 2014
 15:15:54 -0700 (PDT)
X-Received: by 10.112.150.103 with SMTP id uh7mr12742354lbb.30.1399673754626;
        Fri, 09 May 2014 15:15:54 -0700 (PDT)
Original-Received: from mail.lysator.liu.se (mail.lysator.liu.se. [2001:6b0:17:f0a0::3])
        by mx.google.com with ESMTPS id ld9si1468138lab.44.2014.05.09.15.15.54
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Fri, 09 May 2014 15:15:54 -0700 (PDT)
Received-SPF: pass (google.com: domain of magfr@lysator.liu.se designates 2001:6b0:17:f0a0::3 as permitted sender) client-ip=2001:6b0:17:f0a0::3;
Original-Received: from mail.lysator.liu.se (localhost [127.0.0.1])
	by mail.lysator.liu.se (Postfix) with ESMTP id 4270E4002A
	for <std-proposals@isocpp.org>; Sat, 10 May 2014 00:15:54 +0200 (CEST)
Original-Received: from sara.home (h-176-10-249-241.na.cust.bahnhof.se [176.10.249.241])
	(using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))
	(No client certificate requested)
	by mail.lysator.liu.se (Postfix) with ESMTPSA id 2CBAB4001E
	for <std-proposals@isocpp.org>; Sat, 10 May 2014 00:15:54 +0200 (CEST)
Mail-Followup-To: std-proposals@isocpp.org
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Virus-Scanned: ClamAV using ClamSMTP
X-Original-Sender: magfr@lysator.liu.se
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of magfr@lysator.liu.se designates 2001:6b0:17:f0a0::3 as permitted
 sender) smtp.mail=magfr@lysator.liu.se
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Content-Disposition: inline
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:10593
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/10593>

Hello.

One thing that have annoyed me for a while is that I can't declare that a
name refers to a type unless I know if the name is a class-name or a
typedef-name when all I want to say is that the name is something I can form
a pointer or a reference to.

I can say

class foo;
void f1(foo&);

and I can also say

using bar = int;
void f2(bar&);

but I lack the ability to say

<typename or something> gaz;
void f3(gaz&);

where all that I tell the compiler is that gaz is a type, but don't have to
say if it is a typedef-name or a class-name.

Now, I do understand the reason for this since f2(bar&) should mangle like
f2(int&) so this suggests some kind of "strong" typedef that introduces a
new name for an existing type, and this is also an often requested feature.

Would it be feasible to introduce a strong typedef in order to allow general
forward declaration of types, or is this an utterly stupid idea?

The strong typedef should introduce a new type and place it in the same
namespace as class-names.

So the proposal is something along the lines of

// Declare two types, say nothing of what they contain

strong typedef aType;
strong typedef aClass;

// Actually define the types

strong typedef int aType; // possibly allow ommitting strong here?
class aClass { };

/MF

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.
