From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Unchecked_Deallocation vs. delete
Date: Fri, 11 May 2007 18:39:21 +0200
Date: 2007-05-11T18:39:10+02:00 [thread overview]
Message-ID: <pulwx90hfwwc$.lkespf2evr6n$.dlg@40tude.net> (raw)
In-Reply-To: 1178871315.928116.262190@e51g2000hsg.googlegroups.com
On 11 May 2007 01:15:15 -0700, Maciej Sobczak wrote:
> On 11 Maj, 09:35, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>
>>> I'm not asking about the spelling (which is ugly for purpose), but
>>> about category.
>>
>> Well, as for categories, what is the benefit of having pointers? If I
>> designed Ada I would make referential derived types (of the target type)
>> instead.
>
> That would be mess. Referential derived types (of the target type)
> when the target type is actually a base for some other type?
These are siblings.
> You mean
> - pointer as a type derived from Vehicle that can refer to Cars,
> Planes and Boats?
No. To have this it should be a pointer type to / derived from
Vehicle'Class.
(When you derive from Vehicle you obtain a member of Vehicle'Class, not the
class itself. So, no derived type knows anything about its siblings)
>>> Then put a run-time check in this Very_Hard_..._Operator.
>>
>> That might mean overhead on some architectures.
>
> Then don't put the test and enjoy undefined behavior, just like with
> U_D.
This is what "Unchecked" stands for in Unchecked_Deallocation. Undefined
operators is in the realm of C++ (:-)).
>>>> Further even if a pointer is constructed with new, it
>>>> can be subject of GC.
>>
>>> So? GC does not prevent me from calling U_D or Very_..._Operator.
>>
>> My comment was about symmetry between new and free.
>
> OK. But even then, GC is not a package that can be just with'ed. It is
> something that has some magic connections with the rest of the runtime
> and as such is part of the language implementation.
I think GC could be made a well-isolated package, because pointers are
typed in Ada. I don't refer to anonymous access types which are agreed
being a C-ish mess. But normal access types are named, so you can set GC at
an access type and only at it.
> The same about U_D
> - I still don't see why it is a library procedure. It plays an
> important role in the language implementation and if its allocating
> counterpart is a built-in operation, then U_D should be built-in as
> well.
If you are asking about "would be nice," then I would make both primitive
operations of the access type interface. And I certainly don't want any
more reserved dictionary words. It became a plague in Ada.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-05-11 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-09 16:27 Unchecked_Deallocation vs. delete Maciej Sobczak
2007-05-09 17:02 ` Dmitry A. Kazakov
2007-05-09 20:56 ` Robert A Duff
2007-05-09 20:59 ` Keith Thompson
2007-05-10 20:09 ` Maciej Sobczak
2007-05-11 7:35 ` Dmitry A. Kazakov
2007-05-11 8:15 ` Maciej Sobczak
2007-05-11 16:39 ` Dmitry A. Kazakov [this message]
2007-05-16 19:25 ` Randy Brukardt
2007-05-10 21:10 ` Markus E Leypold
2007-05-09 17:51 ` Martin Krischik
2007-05-09 20:54 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox