From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71171f53c22d92b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-25 03:17:39 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: C's trikery semantic opens up backdoor in new Linux kernel Date: Tue, 25 Nov 2003 12:20:58 +0100 Message-ID: References: <3FB1A63C.9080200@nowhere.com> <20031114093318.000065b0._elh_@_terma_._com_> <8776svslu9qqo4tp7mump5car7m5asa1fb@4ax.com> NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1069759057 63373026 212.79.194.116 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:2918 Date: 2003-11-25T12:20:58+01:00 List-Id: On Tue, 25 Nov 2003 23:06:52 +1300, Craig Carey 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 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