Express What, not How.

Raffael Cavallaro raffaelcavallaro at junk.mail.me.not.mac.com
Thu Oct 16 20:37:33 EDT 2003


In article <egfzhtx9tu.fsf at vipe.ii.uib.no>, ketil+news at ii.uib.no wrote:

> So, do you agree or not that anonymous functions can improve clarity
> in some cases?

Of course. However, those cases tend to be low level abstractions 
precisely because were talking about _anonymous_ functions, not 
functional abstractions in general. Their anonymity itself prevents them 
from improving the clarity of high level abstractions.

In other words, the higher the level of abstraction, the more we are 
talking in the language of the problem domain. The language of the 
problem domain has a vocabulary with _names_ for entities and their 
interactions. Anonymous functions, by definition _have_no_names_, so 
they can't possibly be isomorphic with the language of the problem 
domain. If an anonymous function _does_ accomplish something identical 
to a named entity or interaction in the problem domain, then you should 
give your anonymous function _that_name_ from the problem domain. Now, 
of course, it is a named function or macro, not an anonymous function 
anymore.

The language of the problem domain, and anonymous functions, are, 
_of_necessity_, mutually exclusive, because the domain experts use 
_names_, not anonymous functions, when they talk about their domain of 
expertise.




More information about the Python-list mailing list