Map Lambda with Side-Effects

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 13 02:47:46 PST 2015


On Tue, 13 Jan 2015 10:06:25 +0000
bearophile via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> Nordlöw:
> 
> > Has there been any discussions on
> > making map require pure functions now that we have each?
> 
> Perhaps I'd like Phobos map and filter to be annotated with 
> "pure" and to have a template constraint that requires their 
> mapping/filtering functions to be strongly pure.

that will effectively rule out any usage of some global vars or other
external state, turning it into either unnecessary mess, or unusable
theoretical crap.

what i think should be written in big red letters in docs is "there is
no guarantees about how many times labmda will be called, with which
args and in which order". so if someone wants to shoot in his foot, he
can ignore that warning and do crazy shooting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150113/bbda67a9/attachment.sig>


More information about the Digitalmars-d-learn mailing list