const debacle

Bill Baxter dnewsgroup at billbaxter.com
Mon Mar 24 08:01:54 PDT 2008


Janice Caron wrote:
> On 24/03/2008, Jarrod <qwerty at ytre.wq> wrote:
>>  I know everyone is throwing in some kind of template or overload idea,
>>  but mine is a little more simple: Change 'in'. Use 'in' to define a
>>  function that will take a value and not change it, but make no guarantees
>>  about the return type
> 
> I'm going to have to join forces with Walter on this one. It doesn't
> matter what syntax you use to declare function parameters - any such
> declaration, whatever the syntax, /will break const correctness/.
> 
> What if I declare
> ...

Or what if we just say const correctness doesn't really belong in a 
language designed to be as easy to use as Python and Ruby?

As time wears on I find myself not becoming any more enthusiastic about 
const in D...
All I wanted was a simple way to avoid simple mistakes in my code.  Not 
a complicated way to avoid complicated mistakes.  And certainly not a 
complicated way to avoid simple mistakes.

--bb



More information about the Digitalmars-d mailing list