logoalt Hacker News

ralukyesterday at 8:46 PM3 repliesview on HN

One thing that most languages are lacking is expressing lazy return values. -> await f1() + await f2() and to express this concurently requres manually handing of futures.


Replies

jayd16yesterday at 10:13 PM

you mean like?

   await Join(f1(), f2())
Although more realistically

   Promise1 = f1(); Promise2 = f2();
   await Join(Promise1, Promise2);
But also, futures are the expression of lazy values so I'm not sure what else you'd be asking for.
show 1 reply
sedatkyesterday at 9:11 PM

Which languages do have such a thing?

show 2 replies
zmjyesterday at 9:30 PM

That's because f2's result could depend on whether f1 has executed.