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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: How to get Ada to ?cross the chasm?? Date: Wed, 9 May 2018 00:02:26 +0300 Organization: Tidorum Ltd Message-ID: References: <1c73f159-eae4-4ae7-a348-03964b007197@googlegroups.com> <87k1su7nag.fsf@nightsong.com> <87po2la2qt.fsf@nightsong.com> <87in8buttb.fsf@jacob-sparre.dk> <87wowqpowu.fsf@nightsong.com> <16406268-83df-4564-8855-9bd0fe9caac0@googlegroups.com> <87o9i2pkcr.fsf@nightsong.com> <87in88m43h.fsf@nightsong.com> <87efiuope8.fsf@nightsong.com> <87lgd1heva.fsf@nightsong.com> <87zi1gz3kl.fsf@nightsong.com> <878t8x7k1j.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 7LFU+ARHcok/PyH+tU1fVwsnosg30O3k5gkCXy5hOHDp5z18Ak Cancel-Lock: sha1:qxxhORxLZs+0Y3cTgSQ7j2aZ4a0= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: Xref: reader02.eternal-september.org comp.lang.ada:52128 Date: 2018-05-09T00:02:26+03:00 List-Id: On 18-05-07 00:02 , Dmitry A. Kazakov wrote: > On 2018-05-06 21:27, Niklas Holsti wrote: > >>> "Applicative" is not a substantial property that hints any concrete >>> implementation of publisher/subscribers bound through the data >>> structure. If Ada should do anything, then provide much better support >>> for user ADTs than it has now. >> >> An applicative data structure is a data structure that can be mutated >> only by constructing what seems to be a modified copy of the entire >> original data structure, but without actually copying most of the >> data, and leaving the original data structure available unmodified. > > That is not a visible property the client may or should see. The client naturally sees if the data structure provides an interface with value semantics or with reference semantics. Value semantics are nicer for the client, but expensive if the implementation uses full, deep, copies. Applicative data structures provide value semantics without needing deep copies, by using hidden references. A client with infinite time and space resources would not care if the value semantics are provided expensively or cheaply. A client with finite resources does care. >> In other words, a mutated version of the structure can be constructed >> only by applying a function to the original version, with the function >> returning the mutated version without harm to the original version. > > This is easily done in present Ada using handles to a reference-counted > objects. Yes, it surely can be implemented in Ada, for some value of "easily". The GC-based languages, especially the lazy functional ones, provide value semantics by default, and systematic ways to make value semantics efficient by means of applicative data structures. > As I said it is quite easy and I used the described approach many times, > e.g. for dealing with decision trees. I too have implemented such things in Ada. I would not call it "quite easy", however. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .