Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-07-16 14:44:03


"Paul Mensonides" <pmenso57_at_[hidden]> wrote in message
news:200507151937.j6FJbJ3e008997_at_milliways.osl.iu.edu...
>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Andy Little
>
>> Oops soory. However this identifies a point which I dont
>> think has been made in this discussion. A generic macro is
>> just a shapeless blob standing in for some text. Therefore I
>> dont see it is possible to make general rules such as to
>> whether a trailing semicolon is included. There is simply not
>> enough definition.
>> One would have to classify the *class* of macro rigorously
>> (probably via the
>> grammar) first. eg is this macro representing a typeid, an
>> assignment-expression etc. Isnt this really what we are
>> discussing ... fitting a macro into the grammar of the
>> language? Identify the *class* of macro in the grammar to
>> identify whether it is possible to use a particular macro in
>> situations where a semicolon is not required, or whether the
>> semicolon is always necessary, hence rightfully included as
>> part of the macro.
>
> I wouldn't mind this approach. In fact, I kind of like it. It puts the
> appropriate emphasis on a macro's syntactic effect. But I don't think that it
> will help the various problems that people have (like extra semicolons) or
> editor issues. For example, if a macro expands to a function definition, then
> there shouldn't be a semicolon, which puts us squarely back in the situation
> we
> have now.

Not sure I understand this. The two macros should be classed separately,
consulting the grammar for the correct useage. I'm guessing that David Abrahams
macro expands to a simple-declaration in the grammar( if the semi-colon is
included, else it would be incomplete grammatically), therefore it should
include the semicolon, which is the only mandatory part incidentally. However
the macro as function-definition is grammatically complete without it.
Of course with this approach macros would ideaaly be complete grammar entities,
which is much neater than trailing semicolons IMO.

FWIW my vote is to include the semicolon in the macro. It conceptually separates
macros from standard code. Its less typing.

OTOH A quick look through the boost libraries suggests that most do require
user to supply semicolon. e.g Concept check, mpl..

regards
Andy little


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk