comp.lang.ada
 help / color / mirror / Atom feed
* Re: Tool to expand generics?
       [not found]     ` <3n1jtk$a0v@Starbase.NeoSoft.COM>
@ 1995-04-18  0:00       ` Robert Dewar
  1995-04-19  0:00       ` Jon Spear
  1 sibling, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1995-04-18  0:00 UTC (permalink / raw)


It is not at all easy to do accurate source expansion of generics. If it
were, then generics would be easy to compile, and they are not :-(

For example, calls that are unambiguous in the template may look ambiguous
in expanded source when you obliterate the distinction between actual and
formal subtypes. 

Similarly (Ada 95) expressions in the template that are legal but will
raise CE, may become illegal in the expanded source because the values
are outside the base range of the actual generic type.

<fill in LOTS more cases here if you ever implemented generics>

Generics are NOT macros!





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Tool to expand generics?
       [not found]     ` <3n1jtk$a0v@Starbase.NeoSoft.COM>
  1995-04-18  0:00       ` Tool to expand generics? Robert Dewar
@ 1995-04-19  0:00       ` Jon Spear
  1 sibling, 0 replies; 2+ messages in thread
From: Jon Spear @ 1995-04-19  0:00 UTC (permalink / raw)


In article <3n1jtk$a0v@Starbase.NeoSoft.COM>,
David Weller <dweller@Starbase.NeoSoft.COM> wrote:
>The odd problem is you're looking for a "macro expansion" tool, which
>is quite common with C++ compilers (well, it used to be, to
>circumvent problems with templates.  I'm not too up to date on C++
>compilers anymore, I've been "++" free for over nine months now :-),
>but the Ada community never really had such a critter.

There are versions of Knuth's WEB system that support Ada.  Among other
things, this allows the construction of complex (or simple) macros that
will be expanded into Ada code before compilation.  For more info,
consult the newsgroup comp.programming.literate or the FAQ:

ftp://rtfm.mit.edu/pub/usenet-by-group/comp.answers/literate-programming-faq

However, it won't expand standard Ada generic instantiations.  

Most C/C++ compilers allow you to save the preprocessor output, after
macro expansion.  It seems reasonable that if there were still Ada
compilers around that implemented generics as macros (as some early
compilers did), they might have an option to save the expanded code. 

-Jon
-- 
|Jon Spear (spear@cs.nps.navy.mil)|Ada95: The World's First International-  |
|Comp Sci Dept, Code CS/Sj, x2830 |Standard OOPL. http://lglwww.epfl.ch/Ada/|




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-04-19  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3mu3bs$ptf@sequoia.jrs.com>
     [not found] ` <3n0t9c$24k@sequoia.jrs.com>
     [not found]   ` <3n113i$fg6@pulsar.sky.net>
     [not found]     ` <3n1jtk$a0v@Starbase.NeoSoft.COM>
1995-04-18  0:00       ` Tool to expand generics? Robert Dewar
1995-04-19  0:00       ` Jon Spear

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox