"Concepts" were removed from C++0x

B

Brian Wood


The conclusion may be the best part of that article:

"Every new proposal seems neat and promising at first but after
a few iterations and redesigns, it might easily turn into a
bloated tumor that impedes the natural growth and evolution of
the language (namespaces anyone?). If we're ever going to have
concepts in C++, it's "the marketplace", not the committee,
that needs to do its work first and only then should the
committee bless the result -- if it so chooses. Doing things
the other way around is a recipe for failure."


I'm not sure why he describes "Yank and ship" as
"seven year's work down the drain." That seems
overblown. I agree with the decision to remove
concepts. The misplaced ' is kind of interesting.


Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
 
I

Ioannis Vranos

Brian said:
The conclusion may be the best part of that article:

"Every new proposal seems neat and promising at first but after
a few iterations and redesigns, it might easily turn into a
bloated tumor that impedes the natural growth and evolution of
the language (namespaces anyone?). If we're ever going to have
concepts in C++, it's "the marketplace", not the committee,
that needs to do its work first and only then should the
committee bless the result -- if it so chooses. Doing things
the other way around is a recipe for failure."


Regarding namespaces, I think it is a great concept and not a failure.

I consider the namespaces example "unfortunate".





--
Ioannis A. Vranos

C95 / C++03 Developer

http://www.cpp-software.net
 
B

Brian Wood

Regarding namespaces, I think it is a great concept and not a failure.

I consider the namespaces example "unfortunate".


I don't care for how a number of Boost libraries reuse
names like list -- there's boost::intrusive::list. I'd
like to change the name of the intrusive class and use
a website to regulate names used in C++ programs.


Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
 
B

Balog Pal

Note, that the author Danny Kalev has a reputation to write BS in books and
articles...

For the curent instance seem like not exception by comments:

<< Two Committee members (Herb Sutter & Robert Klarer) have commented on
that
article, and to quote Herb Sutter: "This article is correct when it says
that concepts are no longer part of C++0x. Beyond that, it's hard to know
where to start with the major errors in fact and characterization, and the
rest is best ignored." >>


I'm not sure why he describes "Yank and ship" as
"seven year's work down the drain." That seems
overblown. I agree with the decision to remove
concepts. The misplaced ' is kind of interesting.

Overblown how? The work was put in. The time, the thinking. Also much
collaterally.

It is being rolled back -- and I'm not sure how the stuff is dealt with
where proposals were withdrawn because 'concepts provide a better and more
general solution'.

Down the drain is pure reality -- another standard release will not happen
in another 10 years following 0x release, by that time C++ may be pretty
obsolete, and/or many current professionals already moved to other fields or
retired. I sure don;t expect to use a concept-implementing C++ compiler in
my life. :(

The time figureas are also not too convincing, that the chosen way will
provide the standard sooner compared to the 'fix it' version, or the
difference being more than 0.5-1 year.

OTOH the compiler writers' approach gives some justification.
 
S

Stephen Horne

Regarding namespaces, I think it is a great concept and not a failure.

I consider the namespaces example "unfortunate".

I like namespaces, but I found it pretty funny some time back when I
read that the C++ hashtable classes are called "unordered_map" etc
because names like "hashmap" are likely to clash with pre-existing
non-standard hashtable implementations.

Avoiding that kind of clash is exactly why the standard library is in
the "std" namespace. But of course people love to write "using
namespace" - and not just for the standard library, but for pretty
much every namespace they have an interest in. End result - the whole
point of using namespaces is defeated, since name clashes are still an
issue regardless.

And it's hard to dismiss this as "if you use this bad style, you
deserve what you get" when the standards guys themselves are fussing
about name clashes where no name clash should ever happen. Kind of
suggests that the battle for good style WRT this issue has already
been lost.

Personally, I think namespaces are ok, but "using namespace" was a
mistake. It would have been better to have a single universal alias
construct, so that any overlong name (type, function, constant, or
whatever) could easily be given a convenient alias when needed.

That is, a command-line utility with lots of standard output use might
have...

alias std::cout cout;
alias std::endl endl;

Rather than...

using namespace std;

Of course it's easy to criticise, everyone has opinions, and hindsight
is no substitute for foresight, etc.
 
B

Balog Pal

Stephen Horne said:
I like namespaces, but I found it pretty funny some time back when I
read that the C++ hashtable classes are called "unordered_map" etc
because names like "hashmap" are likely to clash with pre-existing
non-standard hashtable implementations.

Avoiding that kind of clash is exactly why the standard library is in
the "std" namespace. But of course people love to write "using
namespace" - and not just for the standard library, but for pretty
much every namespace they have an interest in. End result - the whole
point of using namespaces is defeated, since name clashes are still an
issue regardless.

just because there are ways to defeat the benefits (not using NS or using
using directives) doesn't lead to 'still an issue'. Those who want to
control names in general, can do it. Those who stumble in a class with a
couple of independent libraries can deal with it in a not so hard way.

Unfortunately namespaces are not THAT good as looked on paper, and
definitely brought some weird interactions. And some lateral stuff, that
looked good, turned out broken (ADL...)

Ignoring existing libraries with similar names and similar-but-not-same
semantics than something going to standard is IMO bad thinking, and would
create problems. name unordered_* looks strange at first, but makes sense.
And it's hard to dismiss this as "if you use this bad style, you
deserve what you get" when the standards guys themselves are fussing
about name clashes where no name clash should ever happen.

Why?
Since standard I avoid names 'string' 'vector' 'list' 'map' as possible for
types or object names. Even where std:: is not used. To avoid mental
confusion. I do not avoid a ton of other names that are also appear in
std:: but are rare beasts.
Kind of
suggests that the battle for good style WRT this issue has already
been lost.

Also note that writing using declarations [example: using std::string; ] is
NOT considered bad style. The code becomes much more readable if you have a
couple such declarations. hashmap would be a good candidate to be included
in such group.
Personally, I think namespaces are ok, but "using namespace" was a
mistake.

It is extremely handy for some real life situations. Like you stumble on a
clash situation in a few sources and decide to move a library from global to
a namespace. That part is easy. But what with all the existiing code, it all
need prefixes... unless you introduce using there, and add them only in the
problem files. Or even there only use :: operator at the clashing names for
disambiguation.

Also, if you ever use CORBA, and the usual component package convention,
you'll very soon discover the value of using and namespace aliases ;-))
It would have been better to have a single universal alias
construct, so that any overlong name (type, function, constant, or
whatever) could easily be given a convenient alias when needed.

Length is just one particular problem.
That is, a command-line utility with lots of standard output use might
have...

alias std::cout cout;
alias std::endl endl;

Rather than...

using namespace std;

Why not do it the suggested way:

using std::cout;
using std::endl;

Well, you can't provide a new name -- but you didn't want one in the
example, and it's a usual situation.
Of course it's easy to criticise, everyone has opinions, and hindsight
is no substitute for foresight, etc.

LOL
 
S

Stephen Horne

Down the drain is pure reality -- another standard release will not happen
in another 10 years following 0x release, by that time C++ may be pretty
obsolete, and/or many current professionals already moved to other fields or
retired. I sure don;t expect to use a concept-implementing C++ compiler in
my life. :(

Even if that is the right timescale for the next standard (and I
wouldn't be that surprised if it was longer), I don't agree.

As quoted by Brian Wood...

: If we're ever going to have
: concepts in C++, it's "the marketplace", not the committee,
: that needs to do its work first and only then should the
: committee bless the result -- if it so chooses. Doing things
: the other way around is a recipe for failure.

Prior to standardisation, the language was pushed forward rapidly,
first by Stroustrup himself and then by the standardisation process.
Features such as templates had compiler developers chasing the draft
standard. In many cases this worked out well, but in some cases,
mistakes were (at least arguably) made. I'd mention one in particular,
but it might re-open an old argument with James Kanze.

As a language matures, it makes sense to be more conservative and
cautious about changes. And given that concepts are a quite
substantial feature, I doubt we'll see an extension in GCC in a few
months. But I suspect an experimental feature will be available in a
year or so.

These days, we tend to try out new libraries in Boost before
standardising them. It makes sense to be just as cautious about the
core language features.

With Stroustrup himself being "disappointed" that concepts have been
dropped from C++0x, it seems unlikely that the idea will just die.

That said, Stroustrup had an idea for multimethods (aka multiple
dispatch) in C++ once, and the term "vapourware" probably isn't unfair
WRT that. Particularly annoying every time you have to use the visitor
pattern, though several source-to-source translators and DSLs have
been written to work around the issue. I used treecc for a while,
until I wrote my own alternative to work around some issues.
 
S

Stephen Horne

"Stephen Horne" <[email protected]>

Why not do it the suggested way:

using std::cout;
using std::endl;

Well, you can't provide a new name -- but you didn't want one in the
example, and it's a usual situation.

1. The new name thing is directly relevant to the unordered_map
rather than hashmap issue I was discussing. Remember, the clashes
they are trying to avoid are with pre-existing non-standard
libraries. Someone wanting to mix hashmap implementations (e.g.
during a transition from old in-house libraries to new standard
ones) may well want an alias.

2. A single uniform alias construct would be convenient anyway,
irrespective of namespaces. I get annoyed when I just want an
alias for something, and need to figure out what it is in order to
choose the right way to alias it.

For example, is std::endl a constant? A function? What type is it?
Obviously, I never actually alias it, but these are questions I'd
have to answer if I ever did. No big deal - but still a
distraction when all you want is an alias. In fact, rather than
answer those questions, a lot of people would probably take the
easy (in the short term) path - #define. It doesn't seem such a
bad idea - until you use Doxygen, or ...

std::endl might seem exceptional in that the user doesn't
necessary know the type of the thing he's using, but that isn't so
rare as it might seem, especially WRT templates. For example...

template<typename T> void blah<T> ()
{
// what is the type of T::some_member?
}

Also, how exactly do you alias a variable without causing a
run-time overhead? What I tend to do is use a reference
variable...

thing_t& shortname (longname);

But in doing that, I'm risking a significant run-time overhead.
Often I don't care (not an inner loop etc), and very likely the
optimiser can eliminate that overhead anyway, but it's still a
potential issue that IMO should never exist.

3. I'd forgotten that I could use 'using' that way. Personally, I
tend to have a lot of "std::" in my code. And "sh::", for my own
libraries. Occasionally, I'll put "using namespace" in a local
scope somewhere, but I only ever put it at the global level in
trivial (usually regression test) programs.
 
B

Brian Wood

Even if that is the right timescale for the next standard (and I
wouldn't be that surprised if it was longer), I don't agree.

As quoted by Brian Wood...

: If we're ever going to have
: concepts in C++, it's "the marketplace", not the committee,
: that needs to do its work first and only then should the
: committee bless the result -- if it so chooses. Doing things
: the other way around is a recipe for failure.

Prior to standardisation, the language was pushed forward rapidly,
first by Stroustrup himself and then by the standardisation process.
Features such as templates had compiler developers chasing the draft
standard. In many cases this worked out well, but in some cases,
mistakes were (at least arguably) made. I'd mention one in particular,
but it might re-open an old argument with James Kanze.

As a language matures, it makes sense to be more conservative and
cautious about changes. And given that concepts are a quite
substantial feature, I doubt we'll see an extension in GCC in a few
months. But I suspect an experimental feature will be available in a
year or so.

These days, we tend to try out new libraries in Boost before
standardising them. It makes sense to be just as cautious about the
core language features.

That's a good point, but how is it decided what makes it
from Boost to the standard? I'm not excited about some of
the libs that get added. And some others that I think should
make it haven't yet. To a certain extent I guess a library
author who pushes his library and is willing to put in time
writing proposals is able to influence things. What do
people think of adding Boost Intrusive to the standard?

This last go round with the standardization process has been
a mess. I would like to see a new standard every two years
or so. A lot of what will be in the next version of C++
should have already been available for years.


Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
 
B

Brian Wood

Note, that the author Danny Kalev has a reputation to write BS in books and
articles...

For the curent instance seem like not exception by comments:

<< Two Committee members (Herb Sutter & Robert Klarer) have commented on
that
article, and to quote Herb Sutter:  "This article is correct when it says
that concepts are no longer part of C++0x. Beyond that, it's hard to know
where to start with the major errors in fact and characterization, and the
rest is best ignored." >>


Overblown how?  The work was put in. The time, the thinking. Also much
collaterally.

It is being rolled back -- and I'm not sure how the stuff is dealt with
where proposals were withdrawn because 'concepts provide a better and more
general solution'.

Down the drain is pure reality -- another standard release will not happen
in another 10 years following 0x release, by that time C++ may be pretty
obsolete, and/or many current professionals already moved to other fields or
retired.  I sure don;t expect to use a concept-implementing C++ compiler in
my life.  :(


If you're right about it taking 10 years for another release
then there's probably some truth to what you say, but I don't
expect it to be 10 years or even 5 years until there's another
version of the standard.


Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
 
S

Stephen Horne

This last go round with the standardization process has been
a mess. I would like to see a new standard every two years
or so.

That's very rapid revision for a programming language standard.

Fortran has been revised maybe 7 or 8 times since 1953, IIRC. I
believe that the 2008 revision, planned to be a minor revision, missed
2008 and is still not complete.

Ada standards were dated 1983, 1995 and 2005, giving a roughly
decade-long cycle.

Of course there are languages that evolve much more quickly - but how
many undergo formal standardisation? Pascal has IIRC two standard
versions, neither of which is relevant to the real world since "Object
Pascal". And some of these rapidly evolving languages probably have a
generally accelerated fad-driven lifecycle - will Perl, Python, PHP
and Ruby *all* survive in the long term? Will C# be replaced with F#?
And whatever happened to J++ and J#? Or Icon? Or...

I still haven't figured out whether Perl 6 is just a long-running
practical joke or not ;-)
A lot of what will be in the next version of C++
should have already been available for years.

True - but concepts aren't something I want to see rushed. The main
thing I think should have been in the C++ standard years ago is
alignment handling. Also, unrestricted unions IMO should never have
been so severely restricted in the first place - an unrestricted union
can save a lot of hassles. For a data structure node, for instance...

template<typename data_t, size_t node_size> struct node_t
{
union item_t { data_t m; };

size_t m_Size;
item_t m_Items [node_size];
...
};

The point of the union? - it keeps the size and alignment of the
single member, but blocks the automatic constructor and destructor.
The items can then be explicitly constructed and destructed according
to the current size of the node. Achieving this ATM is an awkward and
non-portable pain. I've often wondered (but never checked) how
std::vector and std::deque handle this issue, since both can have
memory allocated for unused and uninitialised objects.
 
J

Jerry Coffin

[ ... ]
This last go round with the standardization process has been
a mess. I would like to see a new standard every two years
or so. A lot of what will be in the next version of C++
should have already been available for years.

The ISO process makes a two year cycle nearly impossible. Expect to
see over a year from the time the last change is made to the standard
until the standard is officially accepted and finalized.
 
B

Brian Wood

The ISO process makes a two year cycle nearly impossible. Expect to
see over a year from the time the last change is made to the standard
until the standard is officially accepted and finalized.

If there's less to review in each version, maybe the
ISO process could be shortened. At any rate, something should
be done to see to it that it doesn't take 10+ years between
updates. Five years seems too long, but at the moment it
would be great.


Brian Wood
Ebenezer Enterprises
www.webEbenezer.net
 
T

tni

Stephen said:
Also, how exactly do you alias a variable without causing a
run-time overhead? What I tend to do is use a reference
variable...

thing_t& shortname (longname);

But in doing that, I'm risking a significant run-time overhead.
Often I don't care (not an inner loop etc), and very likely the
optimiser can eliminate that overhead anyway, but it's still a
potential issue that IMO should never exist.

I would argue that it's the other way around. Using the reference will
give the compiler the option to generate faster code in some cases.

E.g.

std::vector<size_t> blah;
blah.resize(20);
for(size_t i = 0; i < 50; i++) {
size_t& ref = blah[10];
ref += std::rand();
ref += std::rand();
}

Having the reference gives the compiler the guarantee that the address
of vector[10] won't change, so it doesn't have to call operator[] again
(the call is actually inlined, but not eliminated). Of course, semantics
are different, with the reference you have the danger of it going stale
(which can lead to very nice obscure bugs).

The loop with reference is 15 instructions with VS 2005 (release build),
the loop without reference is 24 instructions. With GCC 4.4 (-O2), it's
17 vs. 19 instructions.

(With only one 'ref += std::rand();' in the loop both generate the same
code with or without reference.)
 
B

Balog Pal

Stephen Horne said:
Even if that is the right timescale for the next standard (and I
wouldn't be that surprised if it was longer), I don't agree.

Sure, using the "wishful thinking" magic I wouldn;t agree either, but we
have the real world to face.
: If we're ever going to have
: concepts in C++, it's "the marketplace", not the committee,
: that needs to do its work first and only then should the
: committee bless the result -- if it so chooses. Doing things
: the other way around is a recipe for failure.

That is the very nail in the coffin -- this approach works with libraries,
maybe for some light core extensions, definitely not for a profound change
as concepts.
As a language matures, it makes sense to be more conservative and
cautious about changes. And given that concepts are a quite
substantial feature, I doubt we'll see an extension in GCC in a few
months. But I suspect an experimental feature will be available in a
year or so.

Compiler writers will be implementing whatever the current standard will be.
Then dealing with the fallout. Light features. Pour work into a thing
yanked will hardly gain priority, espevially for the amount of work needed
to have an already working subset.
These days, we tend to try out new libraries in Boost before
standardising them. It makes sense to be just as cautious about the
core language features.

With Stroustrup himself being "disappointed" that concepts have been
dropped from C++0x, it seems unlikely that the idea will just die.

The ide will not die, I was talking about feature I could actually pick for
use. ;-|

But time will tell, there is hardly much point in guessing this early.
 
B

Balog Pal

If you're right about it taking 10 years for another release
then there's probably some truth to what you say, but I don't
expect it to be 10 years or even 5 years until there's another
version of the standard.

We had standard in '98, and the next real thing will be, as looks now not
earlier than '12. (I don't count '03 as anything but a sour patch.)

Work on 0x started around '00 and being kept in 10 years seemed realistic by
all means. yet it will quite overextend.

I expect the thing repeating: in 5 years after the current release we'll
likely see a TC, that just fixes what turned out broken (even without
concepts there is a ton of new stuff, includeing wild interactions due to
threads) without any attempt to real change.

We also may see pure library extensions like tr1 -- those are relatively
easy to manage, if the source is written and is working for years, and only
need replacing boost:: to tr1::.

What wuld you think could make the core changes faster to standardise?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,007
Messages
2,570,266
Members
46,863
Latest member
montyonthebonty

Latest Threads

Top