This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++, cxx-reflection] Initial thoughts on type reflection.


Mark Mitchell <mark at codesourcery dot com> writes:

[...]

| > | > What I'm proposing is to generalize the syntax
| > | > 
| > | >         postfix-expression ( expression-list_opt )
| > | > 
| > | > to allow "type-id"s in the expression-list.
| > | 
| > | This is both complicated and unncessary.
| > 
| > Why and how?  
| > 
| > Please note that the syntactic category "postfix-expression" includes
| > the followinf productions:
| > 
| >     typeid ( expression )
| >     typeid ( type-id )
| >      
| > 
| > which matches what I'm proposing.  
| 
| You proposed:
| 
|   postfix-expression ::= 
|    postfix-expression ( expression-or-type-id-list-opt)
| 
|   expression-or-type-id-list:
|     expression
|     | expression , expression-or-type-id-list
|     | type-id
|     | type-id , expression-or-type-id-list
| 
| If you want these new expressions to be postfix-expressions, that's fine
| with me, but I don't like your production.  Instead, you should use:
| 
|   postfix-expression ::=
|     magic_foo ( type-id , expression )
|     | magic_bar ( type-id, type-id )
|     | magic_baz ( expression )
|     | magic_baz ( type-id )
| 
| That is how typeid works; it is a keyword with special operands.

Next time, I'll speak Algebra instead of English, maybe that will save
us time :-)

What I wanted is:

   postfix-expression ::=
        <standard productions>
      | compile-time-operator ( expression-or-type-id-list )

   compile-time-operator ::=
      <(non closed) list of compile-time operators>

I was calling the thingies involved in the last line "built-ins".

Now, I believe we're in agreement.

[...]

| The thing is that these things are *keywords* -- they are not
| identifiers.

Algebra may sometine be confusing:  typeid is an identifier.  Yes, it
is also an operator :-)  But I think I get what you wanted to say.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]