How does laziness and UFCS interact?

Logan Capaldo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 10 07:40:59 PDT 2015


On Monday, 9 March 2015 at 22:15:43 UTC, Ali Çehreli wrote:
> You are right. I had the same observation at minute 11:27 
> below, where I warn against UFCS with assumeWontThrow:
>
>
> http://www.youtube.com/watch?feature=player_detailpage&v=oF8K4-bieaw#t=687
>
> Ali

Sorry, which is right? I know ifThrown is lazy, I'm curious about 
the "amount" of the expression that is evaluated lazily.


   a.b().c().assumeWontThrow     vs.  a.b().c().assumeWontThrow
   ^--+----^                                ^-^
      |                                      |
      +- lazy?                               +- lazy?


The video seems to say "don't use lazy functions with UFCS 
because you might think the lazy part gets evaluated first, when 
it does not". Seems reasonable, although I don't know it's any 
different than assumeWontThrow(f()).


More information about the Digitalmars-d-learn mailing list