From 8277675531827381901
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ede379f5dbbc1549
X-Google-Attributes: gidf78e5,public
From: postmast.root.admi.gov@iname.com (blargg)
Subject: Re: Suggestion: "typeof" keyword
Date: 1999/08/28
Message-ID: <user-2708990147050001@as1-dialup-77.io.com>#1/1
X-Deja-AN: 518168567
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7nt3vl$1oe$1@nnrp1.deja.com> <7oh7o8$t3f$1@nnrp1.deja.com> <7ol6hi$ej9$2@news.BelWue.DE> <cTiioXAhAwr3Ew$X@robinton.demon.co.uk> <t7d7ww1vrz.fsf@calumny.jyacc.com> <e4DSyfA4ALs3Ew0Q@robinton.demon.co.uk> <t7r9laz5hj.fsf@calumny.jyacc.com> <7oup0a$8g2$1@nnrp1.deja.com> <37B3C2AD.5AB722AE@lucent.com> <37B5A571.449B@wanadoo.fr> <37B908A8.717CAC2C@lucent.com> <CVJFZFAbaWu3Ew15@robinton.demon.co.uk> <7pcvjs$tk4$1@nnrp1.deja.com> <user-1808991258230001@aus-as3-121.io.com> <37BBE6CC.FE2475E5@physik.tu-muenchen.de> <user-1908991352370001@aus-as5-169.io.com> <slrn7rph2r.e43.sbnaran@localhost.localdomain> <wk4shp3qij.fsf@newsguy.com> <user-2508990222060001@aus-as3-137.io.com> <wkwvuig1a1.fsf@newsguy.com>
X-Original-Date: Fri, 27 Aug 1999 01:47:05 -0500
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 935843020 10587 128.250.29.17 (28 Aug 1999 12:23:40 GMT)
Organization: e-mail address IS valid - but fools the spammers
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN8fUrOEDnX0m9pzZAQGvawGAoQpXNU/YZsSJdVqtoK1vNT34DX1q1gei Z5KdFJhk6V7RSwLAPH66hHiuLCTNGsh4 =vF+l
NNTP-Posting-Date: 28 Aug 1999 12:23:40 GMT
Newsgroups: comp.std.c++

In article <wkwvuig1a1.fsf@newsguy.com>, Kevin Kostrzewa
<tkkost@newsguy.com> wrote:

> postmast.root.admi.gov@iname.com (blargg) writes:
> > >    class Foo;
> > >    typeof<Foo>()::type t;
> > 
> > Hello? What is this for?
> 
> Just trying to cover all of the bases of the syntax for typeof that
> people had been discussing in this thread recently.
[snip]

Even the pointless ones... heh

> > >    Foo f;
> > >    typeof(f)::type t;
> > > 
> > > Also, if typeof is written in terms of the language,
> > 
> > Which can't be done, so this is not an issue. typeof cannot be implemented
> > with the current language.
> 
> That's right.  I was taking Siemel's idea of allowing :: to be used on
> an expression and running with the concept.  Sorry again if that
> wasn't obvious.

This is funny. Everyone keeps attributing the ideas to different people
:-)  I'd like to make proper attributions.

I had suggested allowing a type to be accessed of a pointer/ref using
normal member access syntax

    ref.type x = y;

    ptr->type x = y;

This was partly based on a freak incident that I caught where my compiler
was allowing a temporary to be created from a type accessed off a
*pointer*. How's that for a compiler bug being the source of an idea? :-)

Then, Christopher Eltschka suggested that the scope resolution operator
(::) be used instead, since it never evaluates its LHS (the LHS is never
an expression anyway). The reasoning was that it would be more intuitive
than member access, since (now) the LHS is always evaluated. I guess I
consider this a little better, though it makes access off a pointer
inconvenient:

    (*ptr)::type // instead of ptr->type

However, it is perhaps clearer that type isn't a data/function member, as
it may seem if accessed using normal member syntax. Consider this:

    f( p->x( y ) );

Is x a type or function (or member)? Could be any. Not that this is
necessarily a problem, as this sort of encapsulation could be useful at
times.

> > [snip declare mess :-)  ]
>
> Yeah, it was pretty messy.  Just thinking out loud.

A good thing. Put all the ideas on the table, then sort them out. Save the
crazy ones for a rainy day :-)

Please don't let my criticisim of ideas (or anyone else's) discourage you
from posting them. I see myself (and others) separate from their ideas. As
long as one keeps detachment, one can be productive in improving the ideas
on the table. Bad idea? Put it aside.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]



