• R/O
  • SSH

Referencing: 仓库概述

Reference counting smart pointers library for Ada

Enables inner tagged types operations to accept and return references wrapping these types' accesses by using special tricks. This way naked unsafe access values can mostly be eliminated, something that other smart pointers fail to provide.

Recent Commits RSS

Rev. 时间 作者 Message
85665228bd39 2019-09-10 21:27:31 Sergey Dukov ADA95 tip #32744 Удалена неиспользуемая функция "Self"
a45895d5ef6e 2019-09-10 18:02:37 Sergey Dukov ADA95 #32744 Результат после удаления дополнительных стековых ф...
6c8c09199294 2019-09-10 13:58:44 Sergey Dukov ADA95 #32744 Изменение атрибутов Inline
63238e5ad7d6 2019-09-10 13:07:17 Sergey Dukov ADA95 Обращённый набор изменений: 028e5b8ef1dc #32744
028e5b8ef1dc 2019-09-08 21:19:26 Sergey Dukov ADA95 Изменения в файле build.txt
9cef7d4ab0e2 2019-09-08 15:37:07 Sergey Dukov ADA95 Изменения в файле build.txt
7ab19e93dc9d 2019-09-08 15:09:07 Sergey Dukov ADA95 Create ADA95-Branch #32737
52ac65006ea3 2018-06-21 10:17:39 Ivan Levashev 卜根 <bu_ Fix Assign
fe7c2892b680 2018-06-19 06:29:02 Ivan Levashev 卜根 <bu_ Stress test with -O3
8cb648e8403e 2018-06-18 03:34:40 Ivan Levashev 卜根 <bu_ More elegant Implicit_Dereference 'Address overloading wo...

Recently edited Tags

名称 Rev. 时间 作者
tip 85665228bd39 2019-09-10 21:27:31 Sergey Dukov


名称 Rev. 时间 作者 Message
ADA95 85665228bd39 2019-09-10 21:27:31 Sergey Dukov #32744 Удалена неиспользуем...
default 52ac65006ea3 2018-06-21 10:17:39 Ivan Levashev 卜根 <bu_ Fix Assign


Reference counting smart pointers library for Ada

1. Convenient reference handling, as convenient as in languages with ARC,
notably Delphi interfaces and Objective-C.
2. Compatibility with Ada 95 and AdaMagic [to be done].
3. Avoiding retain/release burden if developer wants to.

See Tester/Referencing.Tester.ads for a sample of usage.

1. In Delphi developer writes API using smart pointers (interface references) 
and then mirrors it to tagged records (classes). When doing so, if method 
accepts a smart pointer in argument or returns smart pointer as result, the 
class method does the same. In Ada smart pointer implementation this is 
usually not true, and not possible to accomplish. Consider this example from 

   -- ...
      type Encapsulated is abstract new Refcounted with private;
   package Smart_Pointers is
      -- ...
      type Encapsulated_Access is access all Encapsulated'Class;

      type Ref is tagged private;
      -- ...

This way Ref is only available after Encapsulated, so Encapsulated cannot 
accept Ref arguments and cannot return Ref results like in Delphi, cannot 
have Ref fields like in Delphi, or store Ref in container fields. Having 
cycled structures requires special tricks. Having cycles in Ada is only 
possible via access types, they can point to types not yet fully declared.

So generic package cannot declare Encapsulated_Access, it must be done 
outside. Also, generic cannot accept Encapsulated type as argument. As soon 
as passing Encapsulated type is not possible, passing Encapsulated_Access 
inside is not possible in a way so that generic is aware of access nature of
Encapsulated_Access. Thus, generic has to be unaware of Encapsulated_Access 

No one before implemented smart pointers in Ada this way.

2. Most likely all sources have to be rewritten, but some degree of 
compatibility is possible. Limited references used to prevent overhead of 
retain/release won't be limited, Data will be public field, and explicit 
".Data.all" must be present in portable code.

3. Ada Adjust/Finalize introduces overhead. See Tester/Output.txt for details, 
and look for Tester/Referencing.Tester.Main.adb for source that produces this 
output. Library gives tools for minimizing this overhead if developer is 
willing to.


The work is produced to accomplish goals of internal development, and further 
development is driven by internal demands. The code is licensed under the 
Apache License 2.0 as recommended by FSF. That is friendly to community and 
business, but not to patent trolls. 

Ivan Levashev,
Show on old repository browser