🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #4081

Re: Better template syntax?

#4081
From: nicolas (n.) chapados
Date: Wed, 17 Apr 1996 14:57
39 lines
2311 bytes
Roman Lechtchinsky wrote:

> Now, personally I would prefer to write something like:
> 
> template<class T { bool operator==( const T& t ) const; }> ...
> 
> Now, what I'd like to know is if something like this has been considered and
> rejected ( and why ) and what other people think about it ( would this be
> really easier to use in practice; do you consider it more elegant than the
> current approach ). Thanks in advance.

Specification of requirements on template arguments in a form similar to
what
you suggest is discussed in Stroustrup's Design and Evolution of C++.
The
reasons leading to the rejection of similar proposals are discussed as
well
(although not to my satisfaction, since one of the stated reasons is
that 
requirements specification can be "emulated" in the language--this was
true
when Stroustrup wrote D&E but is not true any more.)

Note that your and similar approach make it easy to specify positive
requirements on arguments ("this type shall have this and that") but not
negative
requirements ("this type shall *not* have this and that").

---
Nicolas Chapados                          ----Standard Disclaimer---- 
chapados@nortel.ca                        Nortel Technology, formerly
BNR


[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <317433DA.72BE@bnr.ca>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
References: <31741E6C.53CA@cs.tu-berlin.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: "nicolas (n.) chapados" <chapados@bnr.ca>
Newsgroups: comp.std.c++
Subject: Re: Better template syntax?
Date: 17 Apr 1996 14:57:57 GMT
Organization: Bell Northern Research
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <317433DA.72BE@bnr.ca>
References: <31741E6C.53CA@cs.tu-berlin.de>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Nntp-Posting-Host: bmtlh567.bnr.ca 
X-Mailer: Mozilla 2.01 (X11; I; HP-UX A.09.05 9000/712) 
X-Lines: 32
Content-Length: 1223
Originator: clamage@taumet