KBD

Keith Devens .com

Tuesday, December 2, 2008 Flag waving
The very name "selection" implies that you're choosing between two or more variants. So that means that the end... – Dr. Walter Veith
← Bush is not a conservativePush vs. Pull templating →

Daily link icon Tuesday, June 22, 2004

The Spirit of C

There's a great article by Greg Colvin over at Artima on the Spirit of C. I'm a little indignant about some of his comments about Java on the third page (it pains me to count Java in C's lineage), but the article as a whole is very enjoyable.

The article is also very well written. Colvin weaves a discussion of typing throughout, and recounts the transition from B's typeless nature, to adding types in C and more in C++, to adding templates (generics) in C++, and continues on to discuss future possibilities for type inference that could bring C++, or another language such as D, back to the feel of typelessness that the C family of languages lost in their transition from B. His discussion of Java didn't have anything much to add to this thread in the article, which was another reason I disliked that part of it. However, the type inference mentioned is currenly a staple of languages in the ML family, and his account of the evolution of these languages makes it feel as if ML-style type inference will inexorably work its way into more mainstream languages over time.

There's also this neat tidbit about C++'s templates:

Although object-orientation was the initial motivation for extending C to C++, the most powerful extension has turned out to be the generic programming facility provided by templates. Templates were introduced to allow for type-safe containers, so that one could define a class like list<T> just once and then use it for any kind of list element. But in 1994 Erwin Unruh brought an innocent-looking little program to Santa Cruz that failed to compile, but caused the compiler to generate a sequence of prime numbers in its diagnostic output. I recall being mystified, then amused, then horrified. By introducing templates we had inadvertently added a Turing- complete meta-language to C++. At that point we could have restricted the template facility to prevent such meta-programming, but instead we took a gamble and embraced it, which cost us no end of pain as the impact of templates rumbled through the language and library.

← Bush is not a conservativePush vs. Pull templating →

Comments XML gif

Keith Gaughan (http://talideon.com/) wrote:

If type inference doesn't make it into the mainstream, I'll be very disappointed. Now, all I want is some form of polymorphism added to the mix so that in something like:

fun blah x y =
    x * y;;

x and y denote numbers as opposed to integers or floats.

∴ Keith Gaughan | 23-Jun-2004 10:26am est | http://talideon.com/ | #4848

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 6 posts

Recent comments XML

new⇒Perl 6 1.0 in March?

Doh, my mistake. I'm aware of the​relation between Parrot and Rakudo​but I'...

Keith: Dec 2, 1:03am

Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Why no generic OrderedDictionary?

Check​http://www.codeproject.com/KB/recip​es/GenericOrderedDictionary.aspx?d...

Gabrielk: Nov 27, 6:57am

WhatIsMyIP.com

http://www.thesysteminfo.com is​another good alternate to​whatismp.com... I...

Kripz: Nov 26, 8:51pm

Girls, please don't get breast implants

Actually I think it's sweet when a​man loves a woman whether she's big​or n...

218.186.12.228: Nov 26, 9:40am

Generated in about 0.204s.

(Used 8 db queries)

mobile phone