Missing python-like chaining in D

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 24 22:02:58 UTC 2022


On Thu, Feb 24, 2022 at 09:51:09PM +0000, Stanislav Blinov via Digitalmars-d wrote:
> On Thursday, 24 February 2022 at 21:26:04 UTC, H. S. Teoh wrote:
> > On Thu, Feb 24, 2022 at 09:19:38PM +0000, Stanislav Blinov via
> > Digitalmars-d wrote:
> > > On Thursday, 24 February 2022 at 21:05:49 UTC, H. S. Teoh wrote:
> > [...]
> > > > There's std.algorithm.ordered which lets you write:
> > > > > 	ordered(i, 4, n)
> > > > > which isn't too bad, it just needs to be promoted more so >
> > > > > that people are more aware of it.
> > > 
> > > No short circuit though.
> > [...]
> > 
> > The docs don't say it, but it *does* in fact short-circuit if you
> > look at the implementation.
> 
> Yes, but after evaluating all the arguments :)

Hmm, you're right.

Make the arguments lazy?  But then you have the @nogc problem.


T

-- 
Error: Keyboard not attached. Press F1 to continue. -- Yoon Ha Lee, CONLANG


More information about the Digitalmars-d mailing list