comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: C's trikery semantic opens up backdoor in new Linux kernel
Date: Tue, 25 Nov 2003 12:20:58 +0100
Date: 2003-11-25T12:20:58+01:00	[thread overview]
Message-ID: <nic6svksgonaraqtk8go4ecgdd19ih067a@4ax.com> (raw)
In-Reply-To: 8776svslu9qqo4tp7mump5car7m5asa1fb@4ax.com

On Tue, 25 Nov 2003 23:06:52 +1300, Craig Carey <research@ijs.co.nz>
wrote:

>On Fri, 14 Nov 2003 11:16:22 +0100, Dmitry A. Kazakov wrote:
>>On Fri, 14 Nov 2003 10:44:47 +0100, Vinzent 'Gadget' Hoefler wrote:
>...
>>>>On Fri, 14 Nov 2003 10:04:02 +1300
>>>>Craig Carey <research@ijs.co.nz> wrote:
>...
>>>>> Ada 95 could be enhanced so that specified record fields could be
>>>>> read-only.
>>>
>>>BTW, this is a neat idea. OTOH, for this approach to be practical
>>>someone *must* have write access.
>>
>>1. Not always. We already have constant "record" fields in Ada. They
>>are called discriminants.
>>2. Constructor
>...
>
>1. Perhaps Mr Kazakov would priovide more details about the
> "Not Always" comment.

I treat "someone" [having access] as a user of the type. This
"someone" need not to have write access. The whole idea of constant
members is to deprive it from that access. As for Ada improvement,
then it is absolutely clear how to make read-only fields without
having write access. They have to be publicly constants and privately
not. Further, with a better ADT one could make a next step and to
allow an implementation of record fields using primitive operations =
abstract record interface.

>It could be the default assignment of a pointer
>pointing into the interior of the same record.

Yep, this too.

[...]

>Discrimannts are not actually read-only since they don't need to be
>supplied when the variable is declared but can be changed simply
>afterwards. It does not sound like something that is read-only.

I think there is a confusion here. To have a read-only field is not a
property of a variable, but of a value of. It is a [sub-]type which
interface does not allow to change the field. This does not prevent us
from changing the whole value. Yet the field is still read-only. If
you are going to object, then consider a case when the scope of the
variable is leaved and then a new variable is created in another scope
with a value having all the same fields, but the read-only one
changed. The effect would be exactly same as one of changing the
field!

If the goal is to ensure that all values a variable may hold, shall
have *same* field, then it is another thing. For this one should
constrain the corresponding type. Partially it can be done using
discriminants.

Partially, because, yes as you pointed out, not everything may have a
discriminant and not all types are allowed to be ones of
discriminants.

BTW, I by no means against improvement of Ada! (:-))

--
Regards,
Dmitry Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2003-11-25 11:20 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-12  3:17 C's trikery semantic opens up backdoor in new Linux kernel Adrian Hoe
2003-11-12  4:26 ` Stephane Richard
2003-11-12  5:13   ` J Cusick
2003-11-12  7:18     ` Vinzent 'Gadget' Hoefler
2003-11-12  7:50       ` Duncan Sands
2003-11-12 12:08         ` Vinzent 'Gadget' Hoefler
2003-11-12 13:38           ` Duncan Sands
2003-11-12 14:09             ` Vinzent 'Gadget' Hoefler
2003-11-13 21:04               ` Craig Carey
2003-11-14  6:45                 ` Freejack
2003-11-14  8:33                 ` Erlo Haugen
2003-11-14  9:44                   ` Vinzent 'Gadget' Hoefler
2003-11-14 10:16                     ` Dmitry A. Kazakov
2003-11-25 10:06                       ` Craig Carey
2003-11-25 11:20                         ` Dmitry A. Kazakov [this message]
2003-11-14 15:31                 ` Robert I. Eachus
2003-11-14 13:12               ` Georg Bauhaus
2003-11-14 13:31                 ` Duncan Sands
2003-11-14 14:56                 ` Vinzent 'Gadget' Hoefler
2003-11-14 15:08                   ` Georg Bauhaus
2003-11-14 15:38                     ` Duncan Sands
2003-11-14 17:57                       ` Georg Bauhaus
2003-11-14 15:47               ` Robert I. Eachus
2003-11-14 16:38                 ` Vinzent 'Gadget' Hoefler
2003-11-19  4:13             ` Dave Thompson
2003-11-21 15:34               ` Martin Krischik
2003-11-23  2:20                 ` Hyman Rosen
2003-11-27  4:22                 ` Dave Thompson
2003-11-28 14:01                   ` Hyman Rosen
2003-11-12 17:37       ` tmoran
2003-11-12 18:03       ` Warren W. Gay VE3WWG
2003-11-12  8:51     ` Adrian Hoe
2003-11-12 12:32       ` Preben Randhol
2003-11-13  5:50         ` Chad R. Meiners
2003-11-12 22:59       ` Wes Groleau
2003-11-14  3:31         ` Adrian Hoe
2003-11-14 11:00           ` Dmytry Lavrov
2003-11-15  5:00             ` Adrian Hoe
2003-11-15  5:02             ` Adrian Hoe
2003-11-16 11:29               ` Dmytry Lavrov
2003-11-17 17:07                 ` Warren W. Gay VE3WWG
2003-11-16 11:35             ` Dmytry Lavrov
2003-11-15 19:30           ` Wes Groleau
2003-11-12  8:52   ` Adrian Hoe
replies disabled

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