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!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is there a reason System.Storage_Pools isn't Pure? Date: Wed, 19 Apr 2017 21:48:31 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <178b6fbc-229b-49fc-8ffb-a5797bfc335f@googlegroups.com> <61e151c1-9fe6-4d32-8f13-d425bc41a616@googlegroups.com> NNTP-Posting-Host: BYuA7L7MRjuLLjcoGHOBxw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:46598 Date: 2017-04-19T21:48:31+02:00 List-Id: On 2017-04-19 20:50, Shark8 wrote: > On Wednesday, April 19, 2017 at 1:37:33 AM UTC-6, Dmitry A. Kazakov wrote: >> No, so long you don't know what is in the memory. Even considering the >> case of a shared [distributed] memory pool it cannot be pure. > > But of course you know what's in that memory: you put it there. > [Well, the compiler; and since accesses are typed of course we know what they > are.] -- And a pool[-type] obviously can be pure, as it is only a > definition, an interface, if you will. OK, theoretically a pool type can be static. But instances cannot be, so it is not much use anyway. >> E.g. >> initialization of an object in the shared memory must be done only once, >> which does not preclude binding of each shared copy/view, like mapping >> pointers since copies may be located in different virtual address spaces. > > Huh? > While 'pointer' and 'access' are forms of indirection, and > conceptually the same an access is safer as there is no untyped access. > Further, if we use the de facto standard that pointers are an integer > (thanks C [/sarc]) then we can recognize that an access needn't be so > restricted. Indeed there are cases where it *MUST* be more than an > integer, like the case of an access to the value of an unconstrained > array-type,as we *MUST* have the bounds. I meant that you must relocate access types pointing inside the shared/distributed memory. It is no different to load-time relocation of shared libraries. >>> What about a usable-for-anything holder? >> >> Huh, what about fixing initialization/fixed in the first place. We would >> not need kludges like holders if any type could have proper constructor >> and destructor, access types included. > > Perhaps, though maybe you should explain what a proper > constructor/destructor is -- as I'm pretty sure that C++ style *isn't* > what you have in mind. In fact I do. C++ has constructors almost right. Ada has nothing but an ugly Ada.Finalization hack. A user-defined constructor is an anonymous subroutine hooked at a definite stage of object's initialization. It cannot be called explicitly. It cannot be overridden. It is not a primitive operation. It can be safely rolled back on exception propagation. > 1. Value/object identity? I'm not sure where you're getting that > from., could you elaborate/explain? There are things with and without identity. E.g. integer value has no identity. A task type value has. Stateful objects you refer below require identity, obviously. In "X has state S" X is the identity. > 3. This is true; it would be nice to have a clear compile-time and > elaboration-time distinction. > >> It must be reworked from the start, IMO. > > Perhaps, though it does quite well in enforcing a lack of state upon > the compilation-unit; taken in that manner Pure does a good job as an > indicator. You mean immutability. Consider a generic unit parametrized by a constant value declaring things dependent on the constant. It has instances in different states which are pure (not in Ada sense AFAIK) but in the sense of being immutable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de