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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,36a29c2860aff686 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!p1g2000yqm.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Properties Date: Wed, 1 Dec 2010 10:15:35 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <3b84c8e7-1a51-4a7c-9646-119f1fc51478@s4g2000yql.googlegroups.com> <7c064ffc-8454-471f-bade-62b4309b7290@v19g2000yqa.googlegroups.com> <1f9la9inb7hou.50293r1dkf6h$.dlg@40tude.net> NNTP-Posting-Host: 174.28.198.93 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1291227335 12645 127.0.0.1 (1 Dec 2010 18:15:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 1 Dec 2010 18:15:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p1g2000yqm.googlegroups.com; posting-host=174.28.198.93; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16697 Date: 2010-12-01T10:15:35-08:00 List-Id: On Nov 29, 1:34=A0am, "Dmitry A. Kazakov" wrote: > On Sun, 28 Nov 2010 11:43:12 -0800 (PST), Shark8 wrote: > > On Nov 28, 1:15=A0am, "Dmitry A. Kazakov" > > wrote: > >> On Sat, 27 Nov 2010 19:21:55 -0800 (PST), Shark8 wrote: > >>> I would like to submit a proposal for future Ada development; namely > >>> "Properties." > > >> Instead of properties I would prefer a full abstraction of record, arr= ay, > >> access, numeric types. E.g. you declare something as a record of certa= in > >> members and privately implement it as another record with other member= s or > >> as anything you like providing operations to read/write the publicly > >> declared members. I think it is a more simple and more natural to Ada = model > >> than properties. > > > I'm not sure I see the difference between properties and your "full- > > abstraction"; that is to say, aren't properties merely a way of > > implementing that sort of abstraction (though with the additional > > option of being read-only or write-only)? > > You want to expose something as a property, I want to hide the > implementation making the clients think of the thing in the terms I > defined. > > > Couldn't we have something similar to > > > Type Something is record > > =A0S : String_Property; > > end record; > > =A0 =A0type Something is private record > =A0 =A0 =A0 S : String; > =A0 =A0end record; > > or > > =A0 =A0type Properly_Designed_Unbounded_String is > =A0 =A0 =A0 private array (Positive range <>) of Character; > > > Or am I completely misunderstanding your intent? > > Also, do you have a possible syntax for these abstractions? {it may > > help me fully-understand your position.} > > I would use the word "private" to indicate that the implementation follow= s > in the private part, e.g. > > =A0 =A0type Impossible_In_Ada is private array (Positive range <>) of T'C= lass; > private > =A0 =A0type Impossible_In_Ada is record > =A0 =A0 =A0 =A0... -- The type is implemented as a record type > =A0 =A0end record; > =A0 =A0... -- Overriding of the array interface operations required > > Furthermore, I want record, array, access, number be interfaces. I.e. you > should be able to hang, for example, a record view on any type you wanted= : > > =A0 =A0type S is new T and record Foo : String end record with ...; > > Note it is not an extension of S with a new member. It is adding an > interface making S appear to have the component Foo. The physical > implementation might ibe overriding the primitive operation ".Foo" > (getter/setter), or indeed an extension (implementation of a component by= a > component). [I think] I see! (I had to re-read it several times to get what you are saying, and didn't want to post a reply until I did.) It seems to me that your idea and mine are actually quite similar; applying your proposal to internal components of a record virtually yields my idea. (At least to a great degree.)