KBD

Keith Devens .com

Saturday, July 4, 2009 Flag waving
And we know that in all things God works for the good of those who love him, who have been... – Paul (Romans 8:28)
← 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)
:

July 2009
SunMonTueWedThuFriSat
 1234
567891011
12131415161718
19202122232425
262728293031 



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

Recent comments XML

new⇒Wizard's First Rule

> while it is cheesy to some​extent, I actually found it to be​pretty enjoy...

Keith: Jul 3, 6:33pm

I hate Norton Antivirus

I bought Norton 2009 and it is not​installing on my computer!!!
It​seems l...

o'neil: Jun 30, 11:44am

Generated in about 0.19s.

(Used 8 db queries)