Curiosity is bliss · Julien Couvreur's programming blog and more

Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

ValueTuple availability on various platforms

As part of VS2017, we have just released C# and VB support for tuples, which Mads describes in the C# 7.0 announcement post.

Under the covers, C#/VB tuples and corresponding F# 4.1 “struct tuples” are lowered into ValueTuple types of various arities and nesting, and tuple element names are stored in TupleElementNamesAttribute. Vlad describes both in some details in “How tuples relate to ValueTuple” and “More about tuple element names”.

Since the early prototyping work for tuples, we not only focused on language questions, but more generally the end-to-end experience of tuples. Central to that experience is how to make the ValueTuple types available.

Without those types, the compilation will fail and reports error CS8179: Predefined type 'System.ValueTuple`2' is not defined or imported.

In order to maximize scenarios were you can use tuples, we took a two-pronged approach:

  1. provide System.ValueTuple nuget package with support with existing frameworks,
  2. migrate ValueTuple and other types into core libraries as updated frameworks ship.

Naturally, a common question is: how soon can I use tuples without referencing this additional ValueTuple package?

Here is the latest status on migrating ValueTuple types into frameworks (as of April 2017) and the planned shipping vehicles (to the best of my knowledge):

  Version that includes ValueTuple
Full/desktop framework .NET Framework 4.7 and Windows 10 Creators Edition Update (RS2)
Core 2.0 (with planned preview in Q2 2017, release in Q3, see roadmap)
Mono Mono 5.0
.Net Standard .Net Standard 2.0

For older frameworks, the ValueTuple package should help fill the gap, including targets for netstandard1.0 and portable-net40+sl4+win8+wp8 (for Portable Class Libraries). I will keep the package updated as the migration into core libraries progresses, to provide as smooth and transparent an experience as possible.

This picture is further complicated as the ValueTuple types receive some minor updates (such as binary serializability). Such improvements will not be available to users of the ValueTuple package; they will only be implemented in frameworks themselves.

I keep track of all the library work related to ValueTuple types in this work items list. But if you have a specific question, it is probably easier to ask me directly in the comments section. Bug reports should go in the corefx github repo.

Known issues:

  • Degraded QuickWatch experience when debugging an application compiled on the full framework 4.6 or earlier on a machine with 4.7 installed. See issue details. This will be mitigated in first quarterly release of VS2017 and expected to be fully fixed in 4.7.1.

Bacteria Evolving

The evolution of a bacteria, illustrated with an 11 days time-lapse. The bands have increasingly concentrated antibiotics toward the middle.

The-Evolution-of-Bacteria-on-a-Mega-Plate-Petri-Dish2.gif

More info here.

Discrimination in jury selection

Radiolab spun off a podcast series on Supreme Court cases. The most recent one was on racial discrimination in jury selection. It’s excellent, have a listen.

When it highlighted some relevant statistics about blacks being struck off juries by prosecutors, I thought “yep, in the aggregate, this is clear evidence of bigotry and prejudice”.
But upon reflection, I’m less sure.

Jury selection requires attorneys to be selective and discriminate: they want to choose the juries that will increase their chances of winning.
They will use many factors to evaluate good picks: answers provided, background, behavior, and more.
If an attorney is bigoted, he will prioritize his prejudice for skin color (or some other irrational factor) ahead of increasing his chances of winning. He will waste precious strikes that he could have used better. His selection will be worse.
So, assuming that excluding black juries changes the perspectives represented on the jury and affects the outcomes trials, then being bigoted must hurt his win-rate.
This would hurt his career relative to more rational attorneys or firms.

Given that trials are highly rivalrous and competitive and that jury selection is an important part of the trial, it is hard for me to assume that attorneys are so incompetent and are granting the opposing party such an easy advantage. This makes the bigotry thesis less likely in my opinion.
The alternative thesis is that the observed outcome is driven by rational decisions. The podcast explained a few possible such reasons.

Taking a step back, what kind of evidence would let us evaluate and distinguish those two theses?

Although those may not be conclusive data points either (given how hard it is to tell bigotry apart from rational choice), here are some I’d be curious about:

  • Do prosecutors tend to reject black juries more commonly than defense attorneys do?
  • Assuming they are less bigoted (which is not obvious), do black attorneys tend to reject black juries less, on average?
  • Do attorneys that keep blacks on their juries win their cases more, on average?
  • In an experiment, if you train some attorneys with this knowledge, do their win-rate improve?

Aside from sharing those thoughts, I want to mention some related problems which the episode illustrates: how to define and prove instances of discrimination (beyond aggregate and general evidence), and how people adjust their behavior to specific anti-discrimination rules (it’s not clear that you can control/reduce bigotry, even more so in a monopoly service which “customers” can’t avoid).