home *** CD-ROM | disk | FTP | other *** search
/ Solo Programadores 22 / SOLO_22.iso / docs / misc / old / gnatchat.3 < prev    next >
Encoding:
Text File  |  1996-04-29  |  22.6 KB  |  438 lines

  1. Administrative note: If you send mail directly to me (dewar@cs), I will treat
  2. it as a private communication, and will not abstract it to gnat-chat. If it
  3. really seems like it was intended to be abstracted, then I will send a note
  4. asking you. So please send directly to gnat-chat if you want to see your
  5. reply reflected here.
  6.  
  7. General note: sometimes people add to their notes a legend like "speaking for
  8. myself only", or "my views do not necessarily represent the views of company
  9. XYZ". How about we regard *all* contributions to gnat-chat as strictly
  10. individual views? That seems more appropriate in any case.
  11.  
  12. Reference: GC-3.1
  13. Date: 29 Apr 1993
  14. Author: Tom Johnson (tdj@ampere.cca.cr.rockwell.com)
  15. Subject: GNAT Library model
  16. References: GNOTE1 (Apr 12)
  17.  
  18.  >After reading Gnote1, I get the idea that it will be difficult for
  19.  >several users to share a common set of Ada sources (and their
  20.  >resultant object files) without them constantly being recompiled "from
  21.  >underneath" the client compilation units.
  22.  
  23.  >My impression is that when a compilation is performed, all units
  24.  >"with"ed (and the corresponding "with" dependence closure) will be
  25.  >recompiled. I can't believe that this is what was intended by your
  26.  >design. More than one person working on different pieces of a program,
  27.  >where the "stable" pieces are shared would like to avoid interfering
  28.  >with one another if possible.
  29.  >
  30.  >Specifically, in the "Who shot JFK" example in Gnote1, the idea of
  31.  >recompiling Text_Io is extremely distasteful to me. What if there are
  32.  >other clients of Text_Io which other people are developing? Doesn't
  33.  >recompiling Text_Io have an adverse effect on those person(s)?
  34.  
  35. Robert Dewar comments:
  36.  
  37.   Ah! A significant confusion here, and one that we clearly need to work hard
  38.   to avoid, since I am sure it is a likely confusion. The problem is that we
  39.   are using the word recompilation in two senses:
  40.  
  41.     First sense: the action taken by the compiler to recreate the necessary
  42.     semantic information from a source file for use by a client. There are
  43.     in general two ways of recreating this information:
  44.  
  45.       o  Save it in some intermediate form, and then reread this intermediate
  46.      form when a client is recompiled.
  47.  
  48.       o  Go back to the original source and simply recreate the necessary
  49.      information by reprocessing the source.
  50.  
  51.     These are entirely equivalent from a functional point of view. Which is
  52.     faster? That's not entirely clear. The "recompilation" in the second
  53.     approach sounds slower, but it's not clear that it is, because the effort
  54.     of writing and reading the intermediate stuff is often considerable,
  55.     especially given the typical size of this intermediate information.
  56.  
  57.     Second sense: The action of recompiling a unit that requires all client
  58.     units to be recompiled.
  59.  
  60.   The confusion is in realizing that we are using recompilation to solve the
  61.   problem of recreating the semantic information, and then assuming it has the
  62.   effect of the second sense. That's pretty understandable, since recompilation
  63.   is a very familiar concept to Ada users, as is the (sometimes horrible)
  64.   consequences thereof (as in "Darn, I can't believe you recompiled the
  65.   Types package!")
  66.  
  67.   Nothing could be wronger in the GNAT context! The only thing that can
  68.   possibly effect a client of a given unit is editing and modifying the
  69.   source of a unit. Even recompiling a unit and generating a new object
  70.   file for that unit does not bother clients, because the object file will
  71.   be exactly the same as it was before.
  72.  
  73.   In particular, in the Text_Io example, it is true that the spec of Text_Io
  74.   is recompiled (in the first sense) when a client with'ing Text_Io is
  75.   compiled. However, that has NO effect on any clients of Text_Io. Even
  76.   recompiling Text_Io and generating a new object file for it would not
  77.   affect clients (unless a new incompatible version of the compiler was
  78.   used for that compilation). The only thing that would normally effect
  79.   clients is eidting and modifying the spec of Text_Io (a presumably rare
  80.   event!) Indeed one would assume that the source of Text_Io would live in
  81.   some library directory, protected against being edited.
  82.  
  83.   Perhaps we need two different terms for the two senses. I brought this
  84.   subject up at the GNAT design meeting some weeks ago, but no one was able
  85.   to think of good substitute terms.
  86.  
  87.  >I would discourage the denigration of the Ada library approach as "a
  88.  >kludge with so many undesirable characteristics ..." Stick to tangible
  89.  >arguments based on experience with Ada library approaches AND the GCC
  90.  >model. Use the best ideas from both worlds, if possible. This is where
  91.  >the FSF has shone in the past. Set a SUPERB example for all other
  92.  >would-be Ada compiler-writers, just as GCC has for C compiler-writers.
  93.  
  94. Robert Dewar replies:
  95.  
  96.   Well I couldn't believe that I had described the "Ada library approach as
  97.   a kludge", so I had to go look at what I said:
  98.  
  99.     "Note that I don't mention the general Adalib mechanism, because basically
  100.     we regard that as a kludge with so many undesirable characteristics that
  101.     we think most users should avoid it." [GC-2.1]
  102.  
  103.   Quite a different issue! The Adalib mechanism we described is a simulation
  104.   of the Ada library approach which we think is generally undesirable. It is
  105.   mentioned originally to show that one can use scripts to duplicate any
  106.   behavior you want, including notably the ability of the traditional Ada
  107.   library implementation to create programs that are inconsistent with any
  108.   set of sources. It's not that the whole Ada library approach is a kludge,
  109.   but rather the attempt to simulate it exactly, including its peculiarities,
  110.   under GNAT, that is a kludge.
  111.  
  112.   You get a similar effect if for example you move to the Rational system,
  113.   and insist on maintaining text source files with multiple compilation units
  114.   in each file. It can be done, but would sure seem like a kludge in the
  115.   Rational environment.
  116.  
  117.  >I believe that if the present GNAT library approach is adopted, very few
  118.  >people will be able to use GNAT for multi-person projects. It may be
  119.  >o.k. for student programs and the like but it will not be a tool used
  120.  >for serious programming (as GCC is now). If you want GNAT to be adopted
  121.  >as the "Ada equivalent of GCC", make sure that GNAT allows programs to
  122.  >be built by more than one person without each person interfering with
  123.  >the others.
  124.  
  125.   Well I think this is based on the misconceptions. We can't see that our
  126.   approach is inferior from the point of view of people intefering with
  127.   on another. On the contrary, the fact that recompilation per se cannot
  128.   effect clients unless there is an actual change in the sources seems
  129.   an advantage from this point of view, as does the fact that object files
  130.   can be freely moved around on networks, shared etc.
  131.  
  132.  >The purpose of Ada libraries is not to thwart people from reading their
  133.  >"proprietary information", but to provide a repository for information
  134.  >useful to compilers, analysis tools, etc. without recompilation. I
  135.  >consider Ada libraries to be useful, rather than threats to freedom. If
  136.  >your compiler supplier provides an interface to the library that allows
  137.  >you access to it, it's as "open" as it needs to be. My favorite Ada
  138.  >supplier gives me Ada interfaces to the program library and the detailed
  139.  >syntactic and semantic knowledge that I need to do extremely detailed
  140.  >analysis on Ada programs.
  141.  
  142.   Again, we need to reemphasize that for us the sources act as this
  143.   repository. We can access these sources without recompilation in the
  144.   second sense, i.e. in the sense that might be noticeable to anyone. We
  145.   can't see any inherent benefit in avoiding recompilation in the first
  146.   sense, other than so-far unsupported concerns about efficiency.
  147.  
  148.  >Yes, some Ada suppliers do have "closed" library systems. They are
  149.  >being recognized as technically uncompetitive, and they will reap their
  150.  >appropriate rewards.
  151.  
  152.  >It seems to me that the concept of "efficiency" should also consider how
  153.  >"efficient" it is to recompile your whole source tree every time a
  154.  >change is made to a body, just to avoid having an Ada library.
  155.  >Ultimately, people will be waiting on the compilations, and doing more
  156.  >compilations than are required seems to be a waste.
  157.  
  158.   Once more, we absolutely don't "recompile the whole source tree every
  159.   time a change is made to a body." The amount of work we do is comparable
  160.   to any traditional Ada compiler. Whereever that compiler would fetch the
  161.   tree, we fetch the source. Who'll be faster? Wait and see, but I would
  162.   advise not betting too heavily that we'll be slower!
  163.  
  164.   The one place that we do a lot of extra work is for subunits. As I have
  165.   strived to make clear, this is not an essential part of our approach, but
  166.   rather a pragmatic decision in favor of simplicity of implementation (with
  167.   the nice side effect of significantly improving generated code quality). If
  168.   experience shows that this is a significant compilation efficiency issue,
  169.   we will address it later on!
  170.  
  171.  >I believe in the FSF, and the work that Stallman et. al. are doing is
  172.  >admirable. I contribute to the FSF. However, I also use Ada and like
  173.  >Ada libraries because they help me reinforce better software engineering
  174.  >practices than do other language and tools (with equivalent effort on my
  175.  >part).
  176.  
  177.  >Spare me the dogma disguised as technical arguments.
  178.  
  179.  >On other topics:
  180.  
  181.  >In my view, one compilation unit per file is not a "restriction", it's
  182.  >a useful convention for avoiding confusion. I recall having a
  183.  >conversation with an Ada novice who insisted that when he recompiled his
  184.  >bodies, it caused all sorts of other units to be obsolesced. Upon
  185.  >investigation, we found that he had "conveniently" placed the spec
  186.  >(declaration) and body in the same physical file, thus a change to the
  187.  >body did indirectly make other things obsolete. A quick lesson on
  188.  >recommended physical partitioning of spec and body helped a lot.
  189.  
  190.    It certainly does simplify things to only allow one unit per file. We'll
  191.    have to see how others feel about this "restriction" or "useful convention"
  192.    as the case may be! This is definitely one of those decisions where we don't
  193.    want to be dogmatic, but rather find out what people really think they need.
  194.  
  195.  >Re: unit name = file name. Consider that people will want to name their
  196.  >Ada units with appropriate names, but that some OS conventions will
  197.  >thwart users of GNAT, esp. when DOS and some Unix file name limitations
  198.  >will force contrived Ada unit names. Example: a unit named
  199.  >"String_Utilities" is problematic for OS which allow less than 16
  200.  >character file names, assuming the present GNAT approach.
  201.  
  202.   None of the systems that we are contemplating as reasonable systems for
  203.   hosting of GNAT (GNU, Unix, OS/2, NT) has such limitations. We don't regard
  204.   DOS as a credible host. Note the importance of *host* here, it will of course
  205.   be possible to target DOS or any other restrictive environment if someone
  206.   wants to write a GCC code generator that does so!
  207.  
  208.  >In my opinion, the "text file map" looks attractive all of a sudden, and
  209.  >once you've done something like this, you have invented a small part of
  210.  >the "dreaded" Ada library.
  211.  
  212.   Well obviously not so "dreaded", since we include the option in our system.
  213.   It remains to be seen which usage is more popular in practice. We are
  214.   developing GNAT itself using file name conventions and actually sticking
  215.   to 8+3 file names, and finding it quite acceptable. Other people may prefer
  216.   to use the "text file map" approach, and certainly this will be the case if
  217.   there is a host system with a silly limit on file name length.
  218.  
  219.  >In general, I think file naming conventions are o.k., but when there are
  220.  >so many OS-related restrictions already, tying file names and unit names
  221.  >so closely together could force some perverse selection of Ada unit
  222.  >names. The world does not need more bad examples of how to "fold" unit
  223.  >names to fit into OS file naming conventions.
  224.  
  225.  >Re: supporting development of "stubbed" and "real" software with
  226.  >different names. This is what source control systems are for. Dinking
  227.  >with renaming files and such is error-prone and I would encourage the
  228.  >GNAT team to suggest that RCS, etc. be used when people are trying to
  229.  >manipulate alternative implementations of the same unit.
  230.  
  231.  >Re: ASIS support. If making an arbitrary ASIS query results in
  232.  >recompilation of a unit, this will interfere with development of
  233.  >dependent units, won't it? For example, if you call an ASIS query
  234.  >subprogram, does this initiate recompilation for every query?
  235.  
  236.   Again this is part of the big confusion. Yes, the units are recompiled
  237.   (in sense 1) to acquire the needed semantic information for ASIS, but
  238.   that has zero effect on any clients, or on development of dependent
  239.   units.
  240.  
  241.  >Re: getting "tricky" with adding declarations to a unit and allowing
  242.  >them to be "upward compatible". Either do it completely or not at all.
  243.  >Keep your system simple and leave this sort of thing to the people who
  244.  >are doing it in the general case, so that it always works without human
  245.  >intervention. I think you all are going to need your energy to finish
  246.  >the project, without adding more gilding.
  247.  
  248.  >Please convince me that I should get excited about GNAT again. If I
  249.  >wanted to recompile my entire program every time I made a change I'd go
  250.  >back to Prof. Wirth's "visionary" language Pascal. :-(
  251.  
  252.   Well I hope I cleared up your major concern. You certainly won't have to
  253.   recompile your entire program every time you make a change. However, I
  254.   think your parting thought does perhaps confuse two issues. There are two
  255.   reasons for separate compilation:
  256.  
  257.     o  Allow orderly development of the system, by separating it into
  258.        units that can be read, examined, and modified, independently.
  259.  
  260.     o  Reduce time spent on compilation by not requiring the whole program
  261.        to be recompiled every time.
  262.  
  263.   As machines get faster, the importance of point 2 is reduced and perhaps
  264.   even eliminated for all but really large programs. We are nearly there now
  265.   in some circumstances. The Realia COBOL compiler, written entirely in COBOL,
  266.   will compile itself (about 120,000 lines) in less than a minute on a top of
  267.   the line PC. On the other hand, the importance of point 1 does not go away
  268.   no matter how fast compilers yet. Pascal of course fails to satisfy either
  269.   requirement, and that is a real defect (real Pascal systems of course cure
  270.   this defect, an Ada programmer looking at Borland Pascal will feel quite at
  271.   home with its separate compilation facilities).
  272.  
  273. Reference: GC-3.2
  274. Date: 29 Apr 1993
  275. Author: Richard Stallman (rms@gnu.ai.mit.edu)
  276. Subject: GNAT Library model
  277. References: GNOTE1 (Apr 12), GC-2.1
  278.  
  279.   >>I am also a little concerned
  280.   >>that one or more "killer" commercial applications will come along
  281.   >>that will have a nice Ada interface (with generics) that will exclude
  282.   >>GNAT users because of the need to have source for the bodies. Although you
  283.   >>say that holding back source is not it the spirit of GNU, the reality
  284.   >>is this is the common practice and GNAT users will suffer because
  285.   >>of the lack of access to these products. Vendors of reusable libraries
  286.   >>are likely to comment that GNAT is "broken". ... Could be a problem!
  287.   >
  288.   > Robert Dewar comments:
  289.   >
  290.   >   Maybe in the commercial world, the distribution of compiler specific
  291.   >   Ada libraries in object form only is common practice (I don't know, I
  292.   >   never saw such a product!) However in the academic/research world, which
  293.   >   is the target community for GNAT, the common practice is to distribute
  294.   >   source.
  295.   >
  296.   >Polak refers to the "meed for source for the bodies". From what I
  297.   >recall of the full description that I read, what GNU Ada needs is the
  298.   >source code for the package specs--not the source code for the
  299.   >procedure bodies.
  300.   >
  301.   >Yet Dewar's reply says nothing about this.
  302.   >
  303.   >Is there really a problem, or have people just misunderstood?
  304.  
  305. Robert Dewar comments:
  306.  
  307.   It certainly is true that in most cases the package body sources are not
  308.   needed. The exception is when the packages contain generic declarations,
  309.   as is likely to be the case for distributed reusable code, or inlined
  310.   subprograms. Indeed the body sources are required in these cases. On the
  311.   other hand, Richard's reminder is appropriate. In a typical situation,
  312.   the reusable code could certainly be organized so that much of the body
  313.   code is not needed in source form, and it would be possible to distribute
  314.   simply an object file.
  315.  
  316. Reference: GC-3.3
  317. Date: 29 Apr 1993
  318. Author: Richard Stallman (rms@gnu.ai.mit.edu)
  319. Subject: GNAT Library model
  320. References: GNOTE1 (Apr 12), GC-2.1
  321.  
  322.  >>If a commercial manufacturer came along and wanted to distribute secure
  323.  >>source for GNAT, the easiest thing would be to encrypt the source, and
  324.  >>then add a decryption circuit in the compiler.
  325.  
  326.  >Please don't propose such nastiness. (Not that it would work;
  327.  >if the compiler can decrypt something, so can the user.)
  328.  
  329. Robert Dewar comments:
  330.  
  331.   It's certainly true that anything the compiler can do, a human can do too,
  332.   with the aid of the compiler if necessary. Note in particular that the basic
  333.   fact that the sources of the compiler are available and modifiable means that
  334.   protection of proprietary code could not be achieved even if the libraries
  335.   were distributed in some intermediate tree form, because if the compiler can
  336.   crack this intermediate form, so can the user.
  337.  
  338.   The kind of protection that is sought here is basically unachievable with
  339.   a completely open technology. The only answer would be to close the
  340.   technlogy (i.e. to keep the GNAT sources proprietary and secret), but that
  341.   obviously is fundamentally inconsistent with the aims of this project.
  342.  
  343. Reference: GC-3.4
  344. Date: 29 Apr 1993
  345. Author: Alex Blakemore (alex@cs.umd.edu)
  346. Subject: GNAT Library model
  347. References: GNOTE1 (Apr 12), GC-2.8
  348.  
  349.  >>Revisiting the issue of allowing multiple units per file, we could take
  350.  >>any of the following three approaches:
  351.  >>
  352.  >>   1.  The current approach, one unit per file period.
  353.  >>
  354.  >>This is an area in which we really would like input. On the one hand we want
  355.  >>to be as flexible as possible. On the other hand, we don't want to introduce
  356.  >>unnecessary complexity into the system. Thoughts anyone?
  357.  
  358.  
  359.  >IMHO, this simple approach is just fine. simple rule for programmers and
  360.  >compiler writers to deal with. most of the time its much clearer anyway.
  361.  >the few times when multiple units per file make sense,
  362.  >(.e.g several related short instantiations) are not frequent or important
  363.  >enough to warrant complicating the compiler.
  364.  >
  365.  >You've made a good decision on this one. stick with it, and
  366.  >spend your valuable time and energy on more important things.
  367.  
  368.   OK, another vote for keeping it simple. Any voices out there pleading for
  369.   multiple units in a single source file?
  370.  
  371. Reference: GC-3.5
  372. Date: 29 Apr 1993
  373. Author: Dave Emery (emery@spectre.mitre.org)
  374. Subject: GNAT Library model
  375. References: GNOTE1 (Apr 12),
  376.  
  377.  >I've read with a great deal of interest GNAT-Note #1 on libraries.
  378.  >There's a limitation of the model, which I have occasionally
  379.  >used on other Ada systems, and that you should document (if I
  380.  >understand everything correctly):
  381.  
  382.  >  If I edit a file but don't finish editing it (i.e.      the file
  383.  >  now contains syntactically illegal Ada), won't the GNAT system believe
  384.  >  that the object file associated with my file is obsolete, since the
  385.  >  text has been touched? (Sometimes I'll work on a file for a couple of
  386.  >  days, and then submit it for recompilation. In the meantime, I and
  387.  >  others are compiling very happily against the old version of the
  388.  >  file.)
  389.  
  390. Robert Dewar replies:
  391.  
  392.   Certainly if you obliterate the old good version of the source, you are in
  393.   trouble! The proper approach is to take a copy of the source, and edit that
  394.   and put it back when you are done. In the GNAT approach, the set of sources
  395.   is effectively the library, and has to be treated with care. Compare the
  396.   situation with editing a C header file, it's exactly the same situation.
  397.  
  398.  >But, the point I'd like to make is that the current documented style
  399.  >(which I note is *not* enforced/required by GNAT), adulterates the
  400.  >package specification filenames, rather than the package body
  401.  >filenames. This, of course, is in the style of the DEC naming
  402.  >conventions, and I find this to be personally very offensive. If you
  403.  >have to screw up the names, screw up the body name, not the spec name.
  404.  >Of course, GNAT permits me to redefine the naming convention, but the
  405.  >GNAT default convention will be very widely used, and there are some
  406.  >real interoperability issues. For instance, what if I choose to adopt
  407.  >the opposite naming convention, "foo-.ada" represents the package body
  408.  >of unit FOO, and try to merge this with someone else's code using the
  409.  >current GNAT default?
  410.  
  411.  >So, I hope you take a good strong look at the GNAT
  412.  >naming convention for filenames, to make sure the default is really
  413.  >the 'best possible' convention.
  414.  
  415.   Currently we implement two defaults, selected automatically from the
  416.   file extension. One is as described in GNOTE1, and the other is to use
  417.   separate extensions (the defaults being .ads and .adb). There is no easy
  418.   way to adjudicate between different people's idea of what is personally
  419.   offensive! However I will note that one advantage of the default choice
  420.   we are making is that the normal case where there is a body will generate
  421.   an obect file with an unadulterated name, since the object file is made by
  422.   compiling the body in the usual case. Anyway, we can't choose defaults that
  423.   satisfy everyone, which is why there are compiler options.
  424.  
  425.   As to mixing code in different styles, the possibilities are to either rename
  426.   foreign imported files to match local naming conventions, or to use a file
  427.   name directory file that indicate the file names that are to be used.
  428.  
  429.  >One more note: I presume that capitalization will be "canonicalized"
  430.  >going from the Ada unit name to the resulting filename. This
  431.  >canonicalization has the same interoperability issue as the package
  432.  >specification/package body differentiation.
  433.  
  434.   Not sure what the issue here is, yes we do canonicalize (to lower case),
  435.   why does that matter? If obviously does not matter in systems that ignore
  436.   case. Why does it ever matter if everyone agrees on systems that do NOT
  437.   ignore case that file names will be all lower case, as is normal practice.
  438.