Closed cloudRoutine closed 8 years ago
Strongly agree. Having rev breaks an important mental model and is at some point going to be a source of the type of bugs that good type systems are designed to eliminate.
The potential implications of strictly evaluating the sequence by converting it to an array are dire--this function is a liability and ought to go.
Strongly agree.
There was also the suggestion from Eirik that we change the signature to 'a seq -> 'a array to make the internal transformation more explicit
Three somewhat obvious points:
+1 to Eirik's idea of making the signature explicit and returning an array. It could also be applied to the other eager Seq.* functions that Don mentions. A lot of times you're perfectly OK with losing laziness, but it's best to know when that happens. As far as I can't tell it shouldn't even break any existing code, outside of weird reflection corner cases.
I think it's a interesting l idea, but it is breaking. And it's hard to make the transition easy with compiler warnings.
Since Array implements Seq, what sort of code would be broken by changing the signature?
@NhlCrd - in compiled .NET code, the return type is significant in the "identity" of a function/method and effectively forms part of the linking data for a function. So changing the return type is a breaking change. My inclination is to mark this as declined per my comments below.
remove Seq.rev from FSharp.Core again [11602140]
Submitted by Steffen Forkmann on 1/27/2016 12:00:00 AM
[ 12 votes ]
the collection regularization was a good idea. Unfortunately we introduced Seq.rev which internally converts to array. This working for most real-life sequences, but breaks laziness. I suggest to mark the function as obsolete and remove it later. See also https://github.com/Microsoft/visualfsharp/issues/902
Response
\ by fslang-admin on 2/4/2016 12:00:00 AM **
Marking as declined per my comments below. That said, if you encounter situations where having Seq.rev has caused bugs, please contact me or post the details below. I’m still interested to know how often this bites in practice. Don Syme, F# Language and Core Library Evolution