Hidden argument kind antipattern

Vladimir Panteleev vladimir at thecybershadow.net
Tue Apr 19 16:47:57 PDT 2011


On Wed, 20 Apr 2011 02:43:50 +0300, bearophile <bearophileHUGS at lycos.com>  
wrote:

> I agree. In my opinion the problem is not you using in your module a  
> language feature designed for that very purpose. What's in question is  
> the syntax of that language feature. I don't mind lazy arguments, but it  
> can be argued that's better for them to require a "lazy" prefix at the  
> calling point too. This little syntax problem that was already raised  
> during the D2 design phase.

I would like to clarify my point:

Inarguably (IMO), the original intention of lazy parameters was to allow  
passing expressions to functions that were evaluated only when required.

David's library evaluates these expressions *in different threads*!

Generally, I would count that any usage of "lazy" counts as abuse except  
for evaluating the argument, at most once, during the function's execution.

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list