comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: formal array types and default values
Date: Thu, 4 Jan 2018 07:02:57 -0800 (PST)
Date: 2018-01-04T07:02:57-08:00	[thread overview]
Message-ID: <81d042d6-a9e0-404e-b77e-9b8ca62b08d1@googlegroups.com> (raw)
In-Reply-To: <053b2370-5c15-4662-a9e3-e1464de206a1@googlegroups.com>

> Other uses of default values are evil, because they hide an operation that 
> should always be explicit. For instance: 
>     type Evil_Integer is new Integer 
>         with Default_Value => 0; 

> Since 0 is a legal, useful value of type Evil_Natural, some code might work by accident when an uninitialized object happened to get the right value by default.
Indeed, I can see it makes sense. Instead of default value it's better to provide a constructor method to the package's client.

      parent reply	other threads:[~2018-01-04 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-30 21:42 formal array types and default values Mehdi Saada
2017-12-30 22:20 ` Niklas Holsti
2017-12-30 23:59   ` Mehdi Saada
2018-01-03  0:52   ` Randy Brukardt
2018-01-03  8:33     ` Niklas Holsti
2018-01-03 20:53       ` Randy Brukardt
2018-01-06  0:10         ` Niklas Holsti
2018-01-08 21:12           ` Randy Brukardt
2017-12-31 12:34 ` Jeffrey R. Carter
2017-12-31 14:55   ` Mehdi Saada
2018-01-03 15:47 ` Mehdi Saada
2018-01-03 21:16   ` Randy Brukardt
2018-01-04 15:02 ` Mehdi Saada [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox