Changeset 59627b3 for doc


Ignore:
Timestamp:
Sep 18, 2024, 4:06:35 PM (3 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
f660b10
Parents:
c329bca (diff), 152944e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/bibliography/pl.bib

    rc329bca r59627b3  
    68206820    booktitle   = {Proceedings of the 9th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages},
    68216821    location    = {Albuquerque, New Mexico},
    6822     series      = {POPL'82}
     6822    series      = {POPL'82},
    68236823    year        = 1982,
    68246824    pages       = {207-212},
  • doc/proposals/modules.md

    rc329bca r59627b3  
    192192At the linker level, an extra step is necessary to perform a transitive closure across module dependences, i.e., build a "using" graph to know what order to run the module constructors.
    193193For example, the heap has to be initialized before any other code that uses it.
     194
     195=============================================================================
     196
     197From: Andrew James Beach <ajbeach@uwaterloo.ca>
     198To: Peter Buhr <pabuhr@uwaterloo.ca>
     199Subject: Re: A Module Proposal
     200Date: Fri, 31 May 2024 20:32:49 +0000
     201
     202Ada uses several constructs for what you described:
     203
     204First the includes are handled by:
     205with MODULE_NAME;
     206
     207(There is a separate "use" command that handles the name spacing part.)
     208
     209In the header file (.ads) you declare:
     210package NAME is BODY end NAME;
     211(NAME is the possibly qualified name of this module, BODY all the contents of the module. Which I think is everything except the with/use commands and whatever comments you would like.)
     212
     213In the source file (.adb) you declare:
     214package body NAME is BODY end NAME;
     215(Same rules on NAME and BODY.)
     216
     217Of course I say same rules for BODY, but obviously it isn't quite the same. You have something like the declaration / definition divide C uses about what goes where. You do seem to have to repeat some information as well.
     218
     219Anyways, I did some double checks, but mostly this is just me rattling off what I remember from earlier investigation of Ada.
     220
     221Andrew
     222________________________________
     223From: Peter A. Buhr <pabuhr@uwaterloo.ca>
     224Sent: May 31, 2024 4:13 PM
     225To: Andrew James Beach <ajbeach@uwaterloo.ca>
     226Subject: Re: A Module Proposal
     227
     228    For the section on "file-links can be embedded in data creating a tree", I
     229    don't know what that means.
     230
     231Think of a file system like a database, where a table can have data and links to
     232other tables. For a program you might have.
     233
     234    for ( link to shared expression ) { link to shared for body }
     235
     236In smalltalk, I believe they have this kind of structure.
     237
     238    class X {
     239        link to some code in another file
     240        code code code
     241        link to some code in another file
     242    }
     243
     244    Then we two ways you can use modules in a language: Visibility and
     245    initialization. I did say a few things about the first, but nothing on the
     246    second.
     247
     248Agreed.
     249
     250    Is there any interaction between modules and local information hiding? None seem to be called out.
     251
     252It was just an outline. I need to look at Ada packets to get more details.
     253
     254    Now you have an example where you declare a module syntax:
     255    What section of code does this wrap? Does this go in a header, a source file?
     256    Is the module also a namespace?
     257    Does the using clause actually trigger #include? How does it interact with #include directives?
     258    Looking at the constructor: is the module a (real) type? If so what properties does it have?
     259
     260Let's see what Ada does with packages. It has to be VERY similar to what CFA
     261needs.
     262
     263    How does this effect organization across translation units? You say it would
     264    put Mike's work into one translation unit, how does it do that and what is
     265    the gain there?
     266
     267module link-lists {
     268    link-list stuff
     269}
     270module arrays {
     271    array stuff
     272}
     273module strings {
     274    string stuff
     275}
     276
     277It is possible to import arrays and not other modules, so the compiler
     278selectively reads the above translation unit for the modules it is looking for
     279and does not have to parse modules it does not need. The code is nicely grouped
     280and named.
     281
     282    "At the linker level", does this mean we also have to rewrite/wrap the compiler?
     283
     284The linker has a whole language that allows you to write complex instructions on
     285what it is suppose to. I don't know how powerful the link language is.
     286
     287  https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_chapter/ld_3.html
     288
     289
     290
     291From: Andrew James Beach <ajbeach@uwaterloo.ca>
     292To: Peter Buhr <pabuhr@uwaterloo.ca>
     293Subject: Re: A Module Proposal
     294Date: Sun, 2 Jun 2024 19:53:56 +0000
     295
     296OK, down the list:
     297
     298> Why does CFA have include files? Why don't we use the Smalltalk for modules?
     299
     300It feels like the IDE is just the surface level of something else. After all, some people already develop Cforall embedded in an IDE (I think, it looks like that is what they are doing when they screen share). Maybe I'm misreading the situation, but it feels like we are talking about the amount of non-code configuration and/or a compile-time vs. runtime divide.
     301
     302> Think of a file system like a database, where a table can have data and links to other tables. For a program you might have.
     303
     304Do you mean includes and other uses of file paths?
     305
     306> In smalltalk, I believe they have this kind of structure.
     307
     308What kind of Smalltalk are we talking about? (Old Smalltalk as OS or something like the relatively modern GNU Smalltalk?)
     309
     310> Let's see what Ada does with packages. It has to be VERY similar to what CFA needs.
     311
     312I will not go over the whole thing again but Ada seems to have for constructs for this:
     313with NAME; imports a qualified module.
     314use NAME; can be used to rename a bunch of qualified names.
     315package NAME is BODY end NAME; declares a module (package) interface.
     316package body NAME is BODY end NAME; provides the implementation for the above.
     317
     318> It is possible to import arrays and not other modules, so the compiler selectively reads the above translation unit for the modules it is looking for and does not have to parse modules it does not need. The code is nicely grouped and named.
     319
     320Can't we already do that by putting them in separate files? Also, how do we get away with parsing only part of a file?
     321
     322Andrew
     323________________________________
     324From: Andrew James Beach <ajbeach@uwaterloo.ca>
     325Sent: May 31, 2024 2:57 PM
     326To: Peter Buhr <pabuhr@uwaterloo.ca>
     327Subject: A Module Proposal
     328
     329I am working of folding the two sections of the proposal and I have some questions.
     330
     331The paragraph on IDE passed languages. What is it for? C and Cforall are not that type of language and you never bring it up again as a comparison.
     332
     333For the section on "file-links can be embedded in data creating a tree", I don't know what that means. For bit I thought you meant includes, but you talk about those separately. Maybe module names using with import statements. Could you go into more detail?
     334
     335Then we two ways you can use modules in a language: Visibility and initialization. I did say a few things about the first, but nothing on the second.
     336
     337Is there any interaction between modules and local information hiding? None seem to be called out.
     338
     339Now you have an example where you declare a module syntax:
     340What section of code does this wrap? Does this go in a header, a source file?
     341Is the module also a namespace?
     342Does the using clause actually trigger #include? How does it interact with #include directives?
     343Looking at the constructor: is the module a (real) type? If so what properties does it have?
     344
     345How does this effect organization across translation units? You say it would put Mike's work into one translation unit, how does it do that and what is the gain there?
     346
     347"At the linker level", does this mean we also have to rewrite/wrap the compiler?
     348
     349
     350
     351From: Michael Leslie Brooks <mlbrooks@uwaterloo.ca>
     352To: Peter Buhr <pabuhr@uwaterloo.ca>,
     353        Andrew James Beach
     354        <ajbeach@uwaterloo.ca>,
     355        Fangren Yu <f37yu@uwaterloo.ca>, Jiada Liang
     356        <j82liang@uwaterloo.ca>
     357Subject: Modules
     358Date: Wed, 26 Jun 2024 20:25:23 +0000
     359
     360I wrote down some of what was said during our call with Bryan today...
     361
     362Peter's modules' intro
     363
     364fine - like cpp public-private
     365med - when bits of several sources mash into a translation unit
     366coarse - the translation unit
     367
     368
     369Bryan's remarks
     370
     371Often a library will have
     372external headers - what others include
     373internal headers - what all the library's units need to know
     374
     375A points to B B can never get outside the library opportunity for object
     376inlining
     377
     378Problem with pimpl pattern is after you do it, the compiler can't see that this
     379is what you're doing, it only sees it's a another plain old object.  If it
     380could benefit from a pragma-pimpl, be assured that the impl part can't leak
     381out, then it could inline the impl.
     382
     383For a Friday discussion group, the team would be interested in an improvement
     384in what C++ can do.
     385
     386
Note: See TracChangeset for help on using the changeset viewer.