Original message from prad [EMAIL PROTECTED]:

> On Monday 22 May 2006 17:54, you wrote:
> ...
> i was puzzled reading something on one of the wikipedia links provided: 
> "The opposite of lazy evaluation is eager evaluation, also known as strict 
> evaluation. Eager evaluation is the evaluation behavior used in most 
> programming languages." 
> http://en.wikipedia.org/wiki/Lazy_evaluation 
> 
> it would seem to me that lazy evaluation makes more sense than eager 
> evaluation since it is both more logical and economical. 
> 
> i do not know much about language interpretation or compilation processes, 
> but 
> how can it possibly be of any advantage to do 2 things when you can get away 
> doing just one? 
> 
> so why would 'most programming languages' NOT use it? there must be some 
> benefit eager evaluation offers despite what seems to be a lack of efficient 
> evaluation. 
> 
> is eager evaluation easier to design or implement perhaps? 

Whether an application is compiled has no bearing on short-circuiting.  This 
feature can be implemented in either environment.

As for why all languages don't use this feature, I suspect it is for purity.  
An expression is specified in code, it should be executed.  OTOH, 
short-circuiting is simply an efficiency optimization.

As for whether it is easier to implement short-circuiting or not, IMO 
short-circuiting isn't that hard to do.  It's really up to the language 
designer as to whether they see that short-circuiting is congruent with the 
goals of the language.  For languages intending on emphasizing pedantic 
behavior prescribed in code, short-circuiting would probably not be 
implemented.  For languages wanting to provide performance optimizations as 
part of the language, implementing short-circuiting makes sense.

Jim

Reply via email to