For Programmers: Free Programming Magazines  


Home > Archive > Scheme > October 2004 > Re: OT: Hygiene in C++ templates?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: OT: Hygiene in C++ templates?
Marcin 'Qrczak' Kowalczyk

2004-10-31, 8:56 am

Lynn Winebarger <owinebar@indiana.edu> writes:

> As the subject indicates, though, I'd like to know whether C++
> templates are hygeinic or not.


No. There are only rules which somewhat increase hygiene, by making
function calls which don't involve template parameters in arguments
resolved at the point of template definition. Other calls are resolved
in a combination of both environments.

In the context of C++ it would not make sense to make all calls in
templates hygienic, because compile-time dispatch relies on calling
an overloaded functions with a particular name - perhaps one defined
after the template.

The problem of hygiene in the other direction, preventing pieces of
code from capturing definitions introduced by the template, doesn't
exist because you can't pass pieces of code to a template.

--
__("< Marcin Kowalczyk
\__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com