Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove second internal ValueOption #5717

Merged
merged 3 commits into from
Oct 2, 2018
Merged

Conversation

forki
Copy link
Contributor

@forki forki commented Oct 1, 2018

No description provided.

@KevinRansom
Copy link
Member

@forki,

I believe that System.ValueOption was introduced with FSharp.Core 4.5, that would mean that the FCS if this change is accepted would require at least FSharp.Core v4.5 in-order to run. I am not certain of the targeting philosophy of FCS, but in the back of my mind, I remember that it was aimed at earlier versions of FSharp.Core:

I.e.
https://github.com/Microsoft/visualfsharp/blob/master/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj#L638

@forki
Copy link
Contributor Author

forki commented Oct 1, 2018 via email

@KevinRansom
Copy link
Member

@forki, I can well imagine he did. Well then FCS needs updating too. Which also explains the ci_part4 build failures I expect.

Kevin

@KevinRansom
Copy link
Member

@forki

Thanks for this

Kevin

@KevinRansom KevinRansom merged commit 496c70d into dotnet:master Oct 2, 2018
@@ -3090,7 +3090,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
| None -> false
| Some mbrTyconRef ->
// Check we can deref system_MarshalByRefObject_tcref. When compiling against the Silverlight mscorlib we can't
if mbrTyconRef.TryDeref.IsSome then
if ValueOption.isSome mbrTyconRef.TryDeref then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, we should have defined an .IsSome property on ValueOption before accepting this change.

Part of the whole point of property syntax is that it creates far less churn when changing type.

@dsyme
Copy link
Contributor

dsyme commented Oct 9, 2018

This change was much more churn than needed - we should have just defined

type ValueOption<'T> with 
    member x.IsSome = match x with ValueSome _ -> true | ValueNone -> false
    member x.IsNone = match x with ValueSome _ -> false | ValueNone -> true
    member x.Value = match x with ValueSome r -> r | ValueNone -> failwith "ValueOption.Value: value is None"

and almost no other changes would have been needed.

@cartermp
Copy link
Contributor

cartermp commented Oct 9, 2018

IMO we should have a separate PR that adds these functions to the public API surface area to match option: https://github.com/Microsoft/visualfsharp/blob/master/src/fsharp/FSharp.Core/option.fs#L8

Doesn't help with churn, but if there is need for it in the compiler then it should probably be added. I expect an RFC is in order for that though.

@forki
Copy link
Contributor Author

forki commented Oct 9, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants