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++ "with" keyword


> I think you missed the point.
> 
> The fact that this can happen - even if you make it illegal, means more 
> maintenance.  Using it from libraries also means that simply adding a 
> member to a library could cause untold number of users to that library 
> have compilation errors.
> 
> Besides, this was a "real" problem with a Pascal program I wrote many 20 
> years ago and why I never used the 'with' keyword since.

I did not miss any point. You said "change the meaning of a program", and
of course ANY change changes the meaning of a program in the literal sense,
so I took it to be the (legitimate) worry that a chnage could cause a silent
change in meaning.

Obviously if you have implicit naming, then introducing new names may
cause existing programs to become illegal. 

A lot depends on whether you want to favor the reader or writer. Your
complaint about having to fix existing programs when a change is made
is about favoring the writer, but the concern about encouraging long
name usage is about favoring the reader.

Note that this is an old discussion in the Ada world. Ada allows the USE
clause to open up visibility, but at the expense of possible illegalities
when new names are used. Some Ada users eschew USE completely, but others
find USE an important capability for improving readability of code.

So I find this general argument against WITH dubious. For sure it is not
a consensus viewpoint, since in practice the world divides between those
who dislike all implicit naming and those who find it valuable. Note that
if such a feature is used, you presumably would prefer not to use it, but
I don't regard that as a good argument for imposing your viewpoint.

The stronger argument against adding WITH in C++ seems to be that there
is already an adequate mechanism for providing short nicknames locally
for long names, and WITH does not provide sufficient extra functionality
to be worth the effort (note that compiler writers will worry that taking
the address of something may degrade the code, so the example with the
reference is an interesting one for the optimization crowd :-)


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