The Artima Developer Community
Sponsored Link

Articles Forum
Your C++ Wish List

82 replies on 6 pages. Most recent reply: Sep 25, 2004 9:00 PM by Chuck Allison

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 82 replies on 6 pages [ 1 2 3 4 5 6 | » ]
Chuck Allison

Posts: 63
Nickname: cda
Registered: Feb, 2003

Your C++ Wish List Posted: Sep 25, 2004 9:00 PM
Reply to this message Reply
Advertisement
C++0x is under construction. Get your licks in while there's still time.

http://www.artima.com/cppsource/wishlist.html


S. Fanchiotti

Posts: 10
Nickname: impatient
Registered: Nov, 2003

Re: Your C++ Wish List (Editorial) Posted: Sep 27, 2004 8:36 AM
Reply to this message Reply
I don't know if I read the wish list well but I didn't see
anny mentioning of the following in the requests for enhancements to the STL:

-- Smart pointer objects (See Josuttis' book or look at the boost library cases)

-- HASH containers... come on this one is a must!

And also, can someone appoint some people that actually program in C++ to that commision. That would make a difference as most practical issues are usually ignored in order to get some theoretical perfection that is never reached.

Chuck Allison

Posts: 63
Nickname: cda
Registered: Feb, 2003

Re: Your C++ Wish List (Editorial) Posted: Sep 27, 2004 8:29 PM
Reply to this message Reply
Actually, the two items you mention are very high in the list. The Boost smart pointers are the basis for what is now being discussed for C++0x. Also, a hash table proposal is being reviewed, so, you're in good company!

old timer

Posts: 1
Nickname: oldtimer
Registered: Sep, 2004

Re: Your C++ Wish List (Editorial) Posted: Sep 27, 2004 11:30 PM
Reply to this message Reply
>11. Extended type information (as much runtime type information as possible for a compiled language)

I guess this would cover introspection (by applying this extended type information to instances).

I would add to this: arbitrary user-created meta data for all constructs. I know this isn't an easy one, but getting something anywhere towards this ideal would be really great.

It's a feature that helps make introspection really useful. For example, when pushing introspection to do persistence, GUI editing, report making, etc. Arbitrary meta data lets you mark up the classes/fields with all sorts of things like a description, or a read-only marker, or marking things as primary state vs derived state, or setting policies for GUI editing (like to say that this Vector2 is a position in the space defined by _that_ transform).

I'm a die hard C++ programmer, but after working with C# for a bit, I found myself wishing C++ could do this. I know it's not fashionable for C++ to add features that "C++ replacement languages" have, but let's just say we are inspired by lisp or something...

Thorsten Bentrup

Posts: 1
Nickname: tbentrup
Registered: Sep, 2004

Re: Your C++ Wish List (Editorial) Posted: Sep 28, 2004 4:58 AM
Reply to this message Reply
I like templates and use them frequently and the most libraries are based on them too, but what I miss is the possibility to define templates with an unknown number of parameters.
The BOOST tuple class or signal/slot classes or many others use copy & paste (or the preprocessor) and they are all limited to a fixed maximal count of parameters (e.g. 3 or 5 or 10).

It would be nice, if C++ could itself construct templates with any number of parameters (as '...' in printf()).

extensions to C++:

- '...' in templates
- '##' is the number of '...' parameters (N)
- '#' iterates over all the parameters (1 - N)

examples:


template<class A, ...> class X
{
typedef # arg#_type;

X(A a, ...) { }
};

template<class T, ...> f(const T& t, ...)
{
g(t, ...);
}

template<typename F, typename T, ...>
class result_of<F(...)>
{
static F f;
static # t#;

public:
typedef typeof(f(...)) type;
};

template <...>
struct group
{
# a#;
group(...)
: a#(#...)
{}
};

template <class Ch, class Tr, ...>
inline
BOOST_IO_STD basic_ostream<Ch, Tr>&
operator << (BOOST_IO_STD basic_ostream<Ch, Tr>& os,
const group<...>& x)
{
os << x.a#;
return os;
}


I know this is hard work for compiler vendors but this would replace many copy & paste code and fewer use of the preprocessor.

I would also appreciate, if the header guards (with "#ifdef") could be replaced by another command
(e.g. "#pragma once" like some (but not all) vendors do - I know that this is another pp-command, but easier to use).

Christian Kotz

Posts: 1
Nickname: cocus
Registered: Sep, 2004

Re: Your C++ Wish List (Editorial) Posted: Sep 30, 2004 7:30 AM
Reply to this message Reply
I would hop for templated typedefs as a means to alias template names. THis greatly would faciliate metaprogramming and would also make C++ more consitent.

Nemanja Trifunovic

Posts: 172
Nickname: ntrif
Registered: Jun, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 1, 2004 9:39 AM
Reply to this message Reply
1. "Controlled virtuality" - like in C# or (even better) C++/CLI. Right now, if you declare a function virtual in a parent class, virtuality will automatically be inherited even if it is not really needed. For instance:

struct IMyInterface {
virtual void fun() = 0;
};

struct MyImplementation {
void fun(); // this one is also virtual
};

In order not to break existing code, maybe it would be a good idea to add a keyword that would "stop" a function from being virtual:

struct MyImplementation {
nonvirtual void fun(); // this one is not virtual
};

2. XML API. I agree we need a good XML API. However, I would strongly suggest to avoid DOM which is non-efficient and not "C++ friendly". Some cursor-based model would be much better, IMHO.

Nemanja Trifunovic

Posts: 172
Nickname: ntrif
Registered: Jun, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 1, 2004 9:41 AM
Reply to this message Reply
Of course, I meant:

struct MyImplementation : IMyInterface {
void fun(); // this one is also virtual
};

Chris Dutton

Posts: 15
Nickname: cdutton
Registered: Jul, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 2, 2004 2:42 PM
Reply to this message Reply
How about templated namespaces?

Chuck Allison

Posts: 63
Nickname: cda
Registered: Feb, 2003

Re: Your C++ Wish List (Editorial) Posted: Oct 3, 2004 8:14 AM
Reply to this message Reply
> How about templated namespaces?

Could you elaborate on that?

Chris Dutton

Posts: 15
Nickname: cdutton
Registered: Jul, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 5, 2004 12:40 AM
Reply to this message Reply
> > How about templated namespaces?
>
> Could you elaborate on that?

I'm not entirely sure I can. By that I mean that I can't foresee all of the side-effects it might have, or weird and possibly uncouth ways in which such a thing might be used.

I do seem to remember at leat a few projects which involved creating numerous templated classes where it seemed every template was using the same information. Rather than specifying that information for each object I used, and thus potentially screwing it up in numerous places, it would have saved a fair amount of time if I had been able to apply that template to the namespace I had wrapped all of those classes in.

Steve Love

Posts: 20
Nickname: essennell
Registered: Sep, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 5, 2004 7:28 AM
Reply to this message Reply
> Rather than specifying that information for each object I
> I used, and thus potentially screwing it up in numerous
> places, it would have saved a fair amount of time if I had
> been able to apply that template to the namespace I had
> wrapped all of those classes in.

Hmmm. Given that a namespace can be re-opened in several source files, this would place a bit of a burden on other people populating that NS.

I don't see it would save you much.

template< typename T >
namespace X
{
   class Z
   {
   };
}
using X< int >::Z;


How do you get an object of type Z?

Z< int > z;
//or
Z z;


You lose ease of understanding for ease of typing.

Steve Heller

Posts: 1
Nickname: stheller
Registered: Oct, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 6, 2004 3:11 PM
Reply to this message Reply
I would like some language/library support for an automatic way to use polymorphism without needing to expose pointers/memory management to the application program. I have developed ways to do this, based on the Coplien "envelope/letter" idiom, but more convenient and flexible. From my experience, I'm pretty sure that many other C++ developers could benefit greatly from support for such a feature, as it is far from obvious how to implement it unless you have seen it before.

Hickman

Posts: 1
Nickname: jgh
Registered: Oct, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 7, 2004 12:15 PM
Reply to this message Reply
No need to be bashful. Can you give us a taste of what you're referring to?

siva chelliah

Posts: 1
Nickname: podian
Registered: Oct, 2004

Re: Your C++ Wish List (Editorial) Posted: Oct 8, 2004 12:21 PM
Reply to this message Reply
What about synchronized keyword to synchronize the whole method (like Java)? This will ensure that programmers do not forget to unlock a semaphore when they return from a middle of a function.

Flat View: This topic has 82 replies on 6 pages [ 1  2  3  4  5  6 | » ]
Topic: Three Minutes to a Web Service Previous Topic   Next Topic Topic: Safe Labels in C++

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use