meetings/2017/LDM-2017-06-13.md
We want nint and nuint to be part of the language. They will be used in contexts where we care about respecting checked vs unchecked in operator behavior, for example.
We have two options for how to represent at runtime:
IntPtr, track the nint or nuint "overlay" in metadata for compile-time consumption onlyIntPtr and potentially exhibit different behavior at runtime tooOption 2 had some objections attached. Let's go through them:
Interlocked.CompareExchange
IntPtr of a nint or nuint as a public field (so it can be passed by ref to existing overloads)IntPtr is more of an opaque handle, whereas nint and nuint are real integers with number semantics.Option 1 has some objections as well:
ToString doesn't work right
dynamic. Is it really so bad?String.Format would exhibit the combination of the first and second problem: passing a nint as an argument, it would box and lose context, so IntPtr.ToString would get called.
Things to ponder regardless of implementation strategy:
nint/nuint and IntPtr? If so, which way (if any) should be implicit?IntPtr today might want to switch to nint. This would mostly just work, but would have very subtle changes of behavior here and there.We are still hung on what to do. We want to more deeply understand objections against Option 1, and understand if mitigations considered would address e.g. Xamarin's concerns.
Float really is a different discussion. Language embedding is less significant: we don't have a notion of checked/unchecked. The main objective would just be to have an alias.