On Tuesday, October 22, 2013 23:40:00 Timothee Cour wrote: > Following the recent thread "front evaluated multiple time with joiner > depending on where extra arg given", I'd like to propose the following > addition in std.range : > > The goal is to ensure that a given range's 'front' method is called only > once per element, allowing one to handle safely side effects in 'front' > methods
Considering that front really isn't supposed to have side effects, I'm inclined to think that putting something like this in the standard library is a bad idea. It just encourages bad code. There's certainly no reason why you can't implement it for your own stuff if you want to, but I don't think that it's something that should be encouraged as it goes against the range paradigm. The getter property for front really should be logically const and logically pure, and a front with side effects should be something reserved for debugging. - Jonathan M Davis
