473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

FYI:Modules in C++ Proposal

This looks very important, and potentially consequential. If it were added
to C++ it would certainly have a significant impact on the language. If
done right, it would be a boon. If done wrong it would be severely
detrimental.

http://www.open-std.org/jtc1/sc22/wg...2005/n1778.pdf

"Introduction
Modules are a mechanism to package libraries and encapsulate their
implementations.
They differ from the C approach of translation units and header files
primarily in that all
entities are defined in just one place (even classes, templates, etc.). This
paper proposes a
module mechanism as an extension to namespaces with three primary goals:
? Significantly improve build times of large projects
? Enable a better separation between interface and implementation
? Provide a viable transition path for existing libraries
Before delving in the detailed benefits and issues of the proposal, this
paper offers some
examples illustrating general principles and common use cases. Along the way
some
nomenclature is introduced to enable concise discussion.
"
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #1
8 1574
Thank you for posting the proposal. I went through most of it.

The following (short and sweet) article provides a simple and intuitive
extension to C++ that accomplishes more. In fact, it has even been
implemented and thoroughly tested.

http://www.zhmicro.com/namespaces.htm

Regards,
Z.

Jul 23 '05 #2
This is mental. Too complicated for too little.

Jul 23 '05 #3
Thank you for posting the proposal. I went through most of it.

The following (short and sweet) article provides a simple and intuitive
extension to C++ that accomplishes more. In fact, it has even been
implemented and thoroughly tested.

http://www.zhmicro.com/namespaces.htm

Regards,
Z.

Jul 23 '05 #4
* Steven T. Hatton:
This looks very important, and potentially consequential.
Yes, it's been important and consequential for fifteen years.
If it were added
to C++ it would certainly have a significant impact on the language. If
done right, it would be a boon. If done wrong it would be severely
detrimental.

http://www.open-std.org/jtc1/sc22/wg...2005/n1778.pdf


Summarizing:

* Bad: Really Awful Syntax (more reuse of existing operators, unreadable).

* Bad: Attempt at unification with namespaces instead of separation of
concerns, more confusion.

* Good: Envelopes (here called 'main'/'~main') & guaranteed initialization
order, explicit export & no header files, but then, those are sort of
minimum for module support, you couldn't very well call it a module
otherwise.

I.e. what's good stems from the general module concept as implemented in a
score of other languages, almost couldn't be avoided, and the particular
concept realization in the proposal seems complex & very ungood.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #5
Zorro wrote:
Thank you for posting the proposal. I went through most of it.

The following (short and sweet) article provides a simple and intuitive
extension to C++ that accomplishes more. In fact, it has even been
implemented and thoroughly tested.

http://www.zhmicro.com/namespaces.htm

Regards,
Z.


You aren't going to get much argument out of me over what you've done. I've
suggested just about the same thing in the past. I will observe, however
that the modules proposal does eliminate the need for the #include
directive. I haven't read it very carfully myself, but I do believe it
offers feature not described in your article. One possibly significant
feature I believe you may have which is lacking in the module proposal is
the `endusing' directive. I'm not sure how much difference there really is
between your product and the scoping rules and import/export features of
modules.

--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #6
Alf P. Steinbach wrote:
* Steven T. Hatton:
This looks very important, and potentially consequential.
Yes, it's been important and consequential for fifteen years.
If it were added
to C++ it would certainly have a significant impact on the language. If
done right, it would be a boon. If done wrong it would be severely
detrimental.

http://www.open-std.org/jtc1/sc22/wg...2005/n1778.pdf


Summarizing:

* Bad: Really Awful Syntax (more reuse of existing operators,
unreadable).


He does offer something of an alternative. He's kind of stuck between a
rock and a hardplace. People don't want new keywords introduced because
they have the potential to break existing code. He is therefore obliged to
make use of what symbols are currently available. I agree the syntax is
potentially confusing. I am fairly comfortable with it because it is close
to what Mathematica uses for packages.
* Bad: Attempt at unification with namespaces instead of separation of
concerns, more confusion.
Keyword problem.
* Good: Envelopes (here called 'main'/'~main') & guaranteed
initialization
order, explicit export & no header files, but then, those are sort of
minimum for module support, you couldn't very well call it a module
otherwise.

I.e. what's good stems from the general module concept as implemented in a
score of other languages, almost couldn't be avoided, and the particular
concept realization in the proposal seems complex & very ungood.


I have to say he has not presented a definite design, but rather suggestions
for which he would like feedback. Or, at least that's my perception.

--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #7
> You aren't going to get much argument out of me over what you've done. I've
suggested just about the same thing in the past. I will observe, however
that the modules proposal does eliminate the need for the #include
directive. I haven't read it very carfully myself, but I do believe it
offers feature not described in your article. One possibly significant
feature I believe you may have which is lacking in the module proposal is
the `endusing' directive. I'm not sure how much difference there really is
between your product and the scoping rules and import/export features of
modules.


Thank you for taking the time to read and comment on the article. I
failed to come up with brief reply on your profound comments. Instead,
I will confine my reply to "elimination of include directive", which is
more specific to C++.

As a language evolves some features will inevitably vanish.
Preprocessor directives should be avoided, except for the following two
(in my opinion).

1. Conditional compilation. This mechanism separates the concerns of
compiler from those of platfrom. There are times we need different
implementations in a small area of the code, depending on platform.

2. Include directive. This can be used orthogonal to conditional
compilation when platform differences are more than a few lines of
code. One can include different header files for different platforms.
It also helps separate definitions from their implementation. It works
well without causing confusion (novice abuse is not an issue here).
There is no need to replace it with a mechanism that involves compiler
action.

Your quote from BR should be read more than just some quote. It is the
framework for how to approach the design of a language.

Regards,
Z.

Jul 23 '05 #8
Zorro wrote:
You aren't going to get much argument out of me over what you've done.
I've
suggested just about the same thing in the past. I will observe, however
that the modules proposal does eliminate the need for the #include
directive. I haven't read it very carfully myself, but I do believe it
offers feature not described in your article. One possibly significant
feature I believe you may have which is lacking in the module proposal is
the `endusing' directive. I'm not sure how much difference there really
is between your product and the scoping rules and import/export features
of modules.
Thank you for taking the time to read and comment on the article. I
failed to come up with brief reply on your profound comments. Instead,
I will confine my reply to "elimination of include directive", which is
more specific to C++.

As a language evolves some features will inevitably vanish.
Preprocessor directives should be avoided, except for the following two
(in my opinion).

1. Conditional compilation. This mechanism separates the concerns of
compiler from those of platfrom. There are times we need different
implementations in a small area of the code, depending on platform.


I've made two suggestions along these lines. One is to have an in-language
`compile_if(const bool condition){/*...*/};'

(Perhaps that could be extended to a switch statement?)

The other is to templateize modules so particular specializations of member
templates could be instantiated based upon the parameters passed to the
module template.

2. Include directive. This can be used orthogonal to conditional
compilation when platform differences are more than a few lines of
code. One can include different header files for different platforms.
It also helps separate definitions from their implementation. It works
well without causing confusion (novice abuse is not an issue here).
There is no need to replace it with a mechanism that involves compiler
action.
I disagree. I have seen the best of'm get bit by Cpp goofs related to both
conditional compilation, and #inclusion. The correspondence between
declaration/definition location and program structure is ad-hoc, and
usually timeconsuming to resolve.

CPP #MACROS (including the #include directive) cripple the efforts to create
powerful development tools because the cut across the natural structure of
the language. This is one major reason why it is so much easier to create
development environments for languages such as C#, Java, and even C++/CLI.
Efforts to overcome the other obstacles such as lack of introspection, and
lack of clearly defined file naming requirements are likewise crippled by
the CPP.
Your quote from BR should be read more than just some quote. It is the
framework for how to approach the design of a language.

Regards,
Z.


I'm familiar with Russell's work. It is instructive regarding computer
science, but not entirely essential. Stroustrup has some things to say
regarding philosophy and "comprehensive 'systems'" in relation to his
pragmatism when designing C++.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Arthur T. Murray | last post by:
Now, suppose that you wanted to write an AI in Python that would implement your mind-model and allow it to grow, mutate, develop. Here is one possible scenario. It would not be necessary to do...
2
by: Robert Rothenberg | last post by:
I am working on a module that when given a CPAN distribution, will return which modules the distribtion requires (by parsing the Makefile.PL using Module::MakefilePL::Parse if the META.yml file is...
40
by: madireddy | last post by:
Hi, Inside a program how do i find out what size has been allocated to pointer using malloc. eg... int *p; p=(int*)malloc(1024*sizeof(int)); now how do find how much has been allocated to p?...
24
by: MLH | last post by:
I have noticed, in the following code snippet, that if tblCorrespondence has no records in it, I get an error 91 later during processing. It complains that an object variable or a With block...
2
by: gbarn | last post by:
Is there a way for me to compile/use modules when I do not have root access to a Unix box? Can I modify the Makefile or set an environment variable, etc.? Thank you, Gary
5
by: yoyo | last post by:
Just to help somebody else if they are looking, we wasted 2 hours last night trying to figure out the problem. (With a manager over our shoulder) We upgraded our 8.1 FP11 instance to FP13....
31
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window?...
25
by: Lennart Benschop | last post by:
Python has had the Decimal data type for some time now. The Decimal data type is ideal for financial calculations. Using this data type would be more intuitive to computer novices than float as its...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.