Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Adding ValueTuple and ITuple to corlib in CoreRT #2399

Merged
merged 6 commits into from
Dec 22, 2016

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Dec 20, 2016

ValueTuple types are supporting the C#7.0 tuples feature. They have been implemented as a standalone CoreFx package, but should be moved down into the various corlibs (mscorlib/desktop and mscorlib/mono are already done) to be consistent with System.Tuple and can be used by other APIs.

This PR does not contain ITuple yet, but I will add it shortly. It is an interface in CompilerServices namespace used for dynamic pattern matching (in a future version of C#). It applies to System.Tuple and System.ValueTuple types. It was implemented in mscorlib/desktop, and I'm in the process of implementing it in other corlibs.

The main purpose for opening this PR at this point is to raise two questions:

  1. where should test code for ValueTuple go?
  2. where is the existing test code for System.Tuple? I could not find it.

FYI @tarekgh @VSadov

@dnfclas
Copy link

dnfclas commented Dec 20, 2016

Hi @jcouv, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by .NET Foundation and real humans are currently evaluating your PR.

TTYL, DNFBOT;

@tarekgh
Copy link
Member

tarekgh commented Dec 20, 2016

looks EditorBrowsableAttribute is not exist in corert yet.

@tarekgh
Copy link
Member

tarekgh commented Dec 20, 2016

cc @jkotas

@jamesqo
Copy link
Contributor

jamesqo commented Dec 20, 2016

looks EditorBrowsableAttribute is not exist in corert yet.

Some related discussion on this here: https://github.com/dotnet/corefx/issues/13746#issuecomment-265792463. It looks like it's being planned to move the attribute down.

@jkotas
Copy link
Member

jkotas commented Dec 21, 2016

where should test code for ValueTuple go?
where is the existing test code for System.Tuple?

CoreRT is going to use tests in CoreFX. (.NET Native has some old tests in TFS as well, but they are going away.)

@jkotas
Copy link
Member

jkotas commented Dec 21, 2016

looks EditorBrowsableAttribute is not exist in corert yet.

If you would like to add/move the EditorBrowsableAttribute to CoreLib as part of this, you are welcomed to. It needs to be added in both CoreCLR and CoreRT CoreLibs.

@jkotas
Copy link
Member

jkotas commented Dec 21, 2016

Same comments as for the CoreCLR change - the .cs files should be exactly same between CoreCLR and CoreRT.

@jcouv
Copy link
Member Author

jcouv commented Dec 21, 2016

@jkotas Regarding CoreCLR and CoreRT files, the new files I added do match now. But Tuple.cs had some differences, which I preserved.

@jkotas
Copy link
Member

jkotas commented Dec 21, 2016

ok

@@ -198,6 +200,8 @@
<Compile Include="System\Reflection\TypeInfo.cs" />
<Compile Include="System\Reflection\TypeInfo.Workaround.cs" />
<Compile Include="System\Reflection\Runtime\CustomAttributes\RuntimeImplementedCustomAttributeData.cs" />
<Compile Include="System\TupleExtensions.cs" />
Copy link
Member

Choose a reason for hiding this comment

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

Nit - we try to make this list sorted alphabetically.

@jkotas
Copy link
Member

jkotas commented Dec 21, 2016

@jcouv I have moved the EditorBrowsableAttribute to CoreLib. You can uncomment it.

@@ -8,11 +8,14 @@ namespace System.Numerics.Hashing

internal static class HashHelpers
{
public static readonly int RandomSeed = new Random().Next(Int32.MinValue, Int32.MaxValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: int?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I don't mind Int32. I'll probably leave as-is.

/// </summary>
public T2 Item2;
/// <summary>
/// T
Copy link
Contributor

Choose a reason for hiding this comment

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

@jkotas The change that recognizes enum.GetHashCode() for CoreRT seems to be in progress: #2117 Should this use EqualityComparer.Default or x?.GetHashCode() ?? 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jkotas Please advise on this question.

Copy link
Member

Choose a reason for hiding this comment

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

Let's change it back to EqualityComparer.Default in CoreRT for now, and create issue to re-enable it once the optimization is in place.

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

Successfully merging this pull request may close these issues.

5 participants