Why the need for an only const ref?

Bill Baxter dnewsgroup at billbaxter.com
Mon Dec 3 07:05:46 PST 2007


Janice Caron wrote:
> On Dec 3, 2007 2:14 PM, Christopher Wright <dhasenan at gmail.com> wrote:
>> Right...now just make sure your modules are small. People using this
>> tactic don't have many friends.
> 
> What's the problem? Read references to buffer get turned into calls to
> buffer(), and those get /inlined/ by the compiler back to
> straightfoward reads of buffer_ (which is private). Write references
> are syntax errors.
> 
> Seems to me it works a treat. Why does this not make you happy?

I think his point is that private means nothing *within* a module, only 
between modules.  So if you write your program as one big module with 
that trick then it's basically like you didn't use it at all.

--bb



More information about the Digitalmars-d mailing list