> On Jan 2, 2016, at 12:13 PM, Brent Royal-Gordon via swift-evolution 
> <[email protected]> wrote:
> 
>> Why should we absolutely add methods with unclear meanings or behavior, when 
>> there are already perfectly clear, if verbose, alternatives? 
>> seq.generate().next() may not be nice, but no one can get fooled by it.
> 
> Well, for one thing, because it doesn't work. You can't call a mutating 
> method directly on a return value without assigning it to a variable first. 
> And put simply, a temporary variable seems a bridge too far to me.

For a possibly-mutating operation, I think it’s perfectly appropriate that you 
have to create an intermediate variable.  If you want to create an extension 
with a “func possiblyConsumeFirst() -> Generator.Element”, you are welcome to 
do so; that’s what extensions are for.  IMO the standard library should not 
hide volatile sequence consumption under a property access.

If I don’t sound sympathetic, it’s because nobody has shown a use-case for this 
functionality, and until I see one I am going to have a hard time believing 
there’s a problem worth solving.  If you want to make the case that we need 
something like this, please show me why. 

-Dave

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to