Uh oh!
There was an error while loading. Please reload this page.
[WIP] Implement implicit converter for F# optionals - #1386
Conversation
eiriktsarpalis
commented
Jul 27, 2016
Hmm, appveyor is failing to build. Reason seems unrelated to changes introduced here. |
KevinRansom
commented
Jul 27, 2016
KevinRansom
commented
Jul 27, 2016
On my machine I synched master, and build net40 proto coreclr notests. I merged your changes and got these errors: Reverted your changes and rebuilt ... everything built fine. So I think the issue is due to your change. Kevin |
eiriktsarpalis
commented
Jul 27, 2016
@KevinRansom thanks, seeing that too on my machine. Wonder what broke here.. |
For lack of time I've removed the auto-insertion implementation and simply kept the implicit converter. It would still improve things although API authors would have to manually insert those attributes. What do you think? /cc @dsyme |
dsyme
commented
Aug 8, 2016
@eiriktsarpalis This looks like a fine addition. Update to master and add some test cases? I'll leave it to @KevinRansom and @otawfik-ms to decide if it fits on the F~ 4.1 schedule. |
eiriktsarpalis
commented
Aug 8, 2016
I'll add those asap. It'd be an immensely useful addition to F# 4.1
|
eiriktsarpalis
commented
Aug 8, 2016
The tests would probably need to be written in C#. Should I add a C# tests
|
dsyme
commented
Aug 8, 2016
@eiriktsarpalis You can probably add tests to "tests/fsharp/core/fsfromfsviacs" (F# from F# via C#). Put the tests in the C# code then trigger them from F# main |
cartermp
commented
Aug 8, 2016
👍 on this making it into F# 4.1, even though we're feature complete. This will be an immediate benefit to a lot of people who are doing plenty of F#/C# interop. I think we should make an exception here. |
KevinRansom
commented
Aug 8, 2016
| { | ||
| public static Tuple<FSharpOption<T>, FSharpOption<int>> MethodWithOptionalParams<T>(T value1, int value2) | ||
| { | ||
| return OptionalParameterTests.API.MethodWithOptionalParams<T>(value1 = value1, value2 = value2); |
There was a problem hiding this comment.
Please invoke this method from the actual test.fs?
Also please add further tests for other uses of the implicit conversion (ones that just utilize the conversion independent of optional parameters).
dsyme
commented
Aug 9, 2016
Off topic now, but IIRC one issue I had with this:
was that OptionalAttribute wasn't available in all portable profiles (e.g. 259). That meant that compilation would change as you move from profile 259 to profile 7 and .NET Standard, which would be unfortunate. |
eiriktsarpalis
commented
Aug 11, 2016
I think it's ready, tests are passing. |
forki
commented
Aug 11, 2016
2,986 additions, 0 deletions in surfacearea for silverlight ? |
dsyme
commented
Aug 11, 2016
@eiriktsarpalis That file can be deleted and the test disabled |
forki
commented
Aug 11, 2016
Much better. Thanks |
dsyme
commented
Aug 13, 2016
Just to mention that over skype I had asked Eirik to add more tests for interop, especially around null, just to check this doesn't break anything for C# consumers. |
eiriktsarpalis
commented
Aug 13, 2016
@dsyme I'll create a second PR that adds those.
|
As discussed in #1254, this PR attempts to improve C# consumption of F# optional parameters in two ways:
Automatically append the OptionalAttribute and DefaultParameterValueAttribute in all optional parameters of F# methods. These will be added in addition to the the already automatically appended FSharp.Core.OptionalArgumentAttribute.'T -> 'T optionin FSharp.Core.