Thank you for this interesting indication !
Documentation about the implementation of Ada 83 generics is very scarce. When reading Katwijk thesis , I found one article by G.Bray in the references and installed a copy on ada83.org :
Implementation Implications of Ada Generics
In short it says there are three paths to implementing generics for Ada 83 ; full sharing of generic bodies (called canonical implementation), macro approach with systematic code duplication, and a middle path with sharing for some āinstances classesā.
The article is very interesting and points to the complexity of the generics treatment (parameters matching rules, contract model compliance, impact on semantic analysis).
You can try poking a couple of the compiler maintainers to see if they have any documentation resources on it that they would be willing to give or point to. Randy Brukardt is the maintainer and author of Janus Ada, so he might have some insight. There are some AdaCore folks as well, but I donāt know what they would be willing to share.
JanusAda: http://www.rrsoftware.com/index.html
Heās also on comp.lang.ada if you use that.
After reading the T.D.Newton article on Ada 83 generics implementation (article mentioned by G.Bray and J. van Katjwick), I am looking for this document :
Jonathan Rosenberg āGenerating compact code for generic subprogramsā, thesis at CMU computer science department, august 1983 , 214 pages.
Is there anybody who could help me getting hands on one book of this thesis ? (accept to sell me an old specimen for example). There is no computerized copy.
I am stuck with generics implementation, even if I begin to grasp the aspects of the problem, it proves rather complicated to implement and generate adequate fasmg code. To compile TEXT_IO, there is INTEGER_IO in there I would like to have in function.
Just to have package NAT_IO is new TEXT_IO.INTEGER_IO( NATURAL ) working (to enter the number of disks in the Hanoi tower program .
(Well the TEXT_IO.GET_LINE procedure works, I could write a specific sub-program to read a number outside of INTEGER_IO, but that would be a kind of cheating. And there is also DIRECT_IO and SEQUENTIAL_IO which are generics too.
I found a copy at the University of Washington Engineering Library. Their book scanner is quite old and stopped working halfway through the scan, so I had to revert to scanning it with my phone. The quality is not great, but it is mostly legible.
Iāll send the link privately as Iām unsure about the copyright status.. I believe non-commercial research is fair use and the thesis was funded by US government contract, so I think itās public domain, but Iām not certain.
Marvelous, thanks a lot ! Now I have all academic elements to study the question.
I think I have found a solution to code the Ada 83 generics through fasmg, a solution which is apparently general. I was misguided with the mixing of static frame pointers and a needed āgeneric instantiation frame pointerā relative to which instance locals and instantiation parameters are referred. In my approach, generic instantiation is treated with a method akin to a subprogram call context, but has a separate frame pointer system. This āgeneric instance frame pointerā is a hidden added parameter to model generic subprograms, parameter filled in by the instance subprogram launcher (whose parameter profile is identical to model sub profile).
Iāll explain it on the framagit as soon as Iāll have verified the concept for INTEGER_IO. I hope it works because It is becoming mind twisting this affairā¦
I couldnāt find a copy; but you might try intralibrary loans: Generating compact code for generic subprograms in SearchWorks catalog and the DOI might be useful: https://dl.acm.org/doi/10.5555/911133
ā sometimes the thesis is available in the institution, so you can call CMUās library; sometimes itās published with an ISBN, which it seems this did not.
Thank you for your reply, I have got one copy with the help of Jeremy, I am reading this interesting work. Simultaneously I implement the idea of the āgeneric frame pointerā hoping to have something working next week.
Many thanks to helpful people of this forum !
Nice!
I did happen to find the original spec for IDL:
Interesting ! I only had an introduction to IDL by Lamb in 1988 in my documentation. Thank you !
Oh, if you only have that, youāre going to want the DIANA reference manual, too:
So, remember:
- IDL is used to describe the DIANA-structure;
- DIANA is a mirror of the AST;
- DIANA is also an abstract data type;
Very nice of you ! Interesting for history, because the framagit doc directory contains the Diana ref manual revision 4 of 1986 which is the base for the Ada 83/Diana front end I work with.
As promised, for those interested, I wrote an explanation of how I process generics in the fasmg back-end of the Ada 83 / DIANA / fasmg TLALOC compiler.
Here it is :
Comments welcome if any.
(after note : before I got invested in the inside of an Ada 83 compiler, I was a simple Ada user. getting inside the compiler thing completely changed my view of Ada 83, and other versions. What a realization of human mind !
For those modern Ada 9X 2X users, imagine the complexity of the tool you useā¦)