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

Clarify unresolved questions in Span RFC #306

Merged
merged 1 commit into from
May 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions RFCs/FS-1053-span.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ type S(count1: byref<int>, count2: byref<int>) =
* Using `inref<T>` in an abstract slot signature or implementation results in the automatic emit of an `modreq` attribute on an argument or return
* Using `outref<T>` in argument position results in the automatic emit of an `[Out]` attribute on the argument

### Overloading:

When an implicit address is being taken for an `inref` parameter, an overload with an argument of type `SomeType` is preferred to an overload with an argument of type `inref<SomeType>`. For example give this:
```
type C() =
static member M(x: System.DateTime) = x.AddDays(1.0)
static member M(x: inref<System.DateTime>) = x.AddDays(2.0)
static member M2(x: System.DateTime, y: int) = x.AddDays(1.0)
static member M2(x: inref<System.DateTime>, y: int) = x.AddDays(2.0)
let res = System.DateTime.Now
let v = C.M(res)
let v2 = C.M2(res, 4)
```
In both cases the overload resolves to the method taking `System.DateTime` rather than the one taking `inref<System.DateTime>`.


### Ignoring Obsolete attribute on `ByRefLike`

Separately, C# attaches an `Obsolete` attribute to the `Span` and `Memory` types in order to give errors in down level compilers seeing these types, and presumably has special code to ignore it. We add a corresponding special case in the compiler to ignore the `Obsolete` attribute on `ByRefLike` structs.
Expand Down Expand Up @@ -381,14 +397,3 @@ namespace System.Runtime.CompilerServices
[unresolved]: #unresolved-questions

None
* What happens if we have two overloads, e.g. in C#

```
void Deconstruct<T, U>(in this KeyValuePair<T, U> k, out T key, out U value) { .. }
void Deconstruct<T, U>(this KeyValuePair<T, U> k, out T key, out U value) { .. }
```

* How the overload resolution interop supposed to work between F# -> C# and C# -> F#? Original Source: See https://github.com/fsharp/fslang-suggestions/issues/648#issuecomment-390157352

* [the generated IL callwith will pass the x argument with an `[<Out>]` attribute](https://github.com/fsharp/fslang-design/issues/287#issuecomment-390203219), this looks incorrect