Adding Modules to C in 10 Lines of Code
Paulo Pinto
pjmlp at progtools.org
Mon May 30 06:13:43 UTC 2022
On Tuesday, 3 May 2022 at 01:54:16 UTC, forkit wrote:
> On Friday, 22 April 2022 at 19:54:13 UTC, Walter Bright wrote:
>> On 4/17/2022 1:12 PM, Walter Bright wrote:
>>> https://nwcpp.org/
>>>
>>> An online presentation.
>>>
>>> Monday at 7PM PST.
>>
>> Slides:
>>
>> https://nwcpp.org/talks/2022/modules_in_c.pdf
>>
>> Video:
>>
>> https://www.youtube.com/watch?v=2ImfbGm0fls
>
> Here is the answer to the 2 questions you posed in your
> presentation:
> (1) why nobody has done this in 40 years?
> (2) what went on with C++ for 20 years?
>
> It's simple.
>
> Rational choice theory tell us, that the reward of the action
> must outweigh the costs incurred.
Stepstone did it for Objective-C with #import, and Apple with
module maps for C and Objective-C, the modules design that
preceeded C++ modules on clang.
Then we have those failed attempts at fixing C like SafeC.
And if we count research work, Bjarne Stroustoup and Gabriel dos
Reis, did it back when they were teaching in Texas university,
here is the 2009 paper,
"A Principled, Complete, and Efficient Representation of C++"
https://www.stroustrup.com/gdr-bs-macis09.pdf
Both Visual Age for C++ v0.4 and Lucid's Energize C++ did 40
years ago, by serializing C++ code into database representation,
both failed due to high hardware requirements for late 80's/early
90's PCs.
Lucid Energize Demo in 1993
https://www.youtube.com/watch?v=pQQTScuApWk
Its database system, Cadillac,
"Foundation for a C++ Programming Environment"
https://dreamsongs.com/Files/Energize.pdf
Visual Age for C++ v4,
http://www.edm2.com/0704/vacpp4/vacpp4.html
> The build environment is totally different from traditional
> compilers. The concept of header files and source code files is
> obsolete. VAC++ utilizes a global approach to definitions and
> implementations. That is, once a definition is processed it
> stays in memory for the duration of the build. To maintain
> compatibility, header files can still be #included. This new
> approach to handling source code is disorienting at first and
> will make migrating existing code to the compiler somewhat
> difficult. Errors pertaining to objects being defined more than
> once will likely occur while migrating. Often these errors are
> incorrect. The work around is to remove the #include line in
> the source file that contains the offending “redefinition”.
https://books.google.de/books?id=ZwHxz0UaB54C&pg=PA206&redir_esc=y#v=onepage&q&f=false
Additionally the way pre-compiled headers work on C++ Builder and
Visual C++, versus the UNIX way, meant that on Windows the reward
of the action did not outweigh the costs incurred, and ironically
Visual C++ is the one leading the C++ modules support anyway,
thanks to Gabriel dos Reis being part of the team, and pinging
back on those 2009 learnings.
More information about the Digitalmars-d-announce
mailing list