Dataset seems to break Information

The problem appears to be due to a v10.2 bug in the Dataset visualization code that generates the box form of a dataset. It is not correctly distinguishing between Dataset being used as a constructor function and Dataset being used as the head of a constructed dataset. It assumes the latter case unconditionally, giving the exhibited messages for the former case.

As a work-around, we can temporarily block the errant definitions while we inspect toDataset:

Block[{Dataset}, Information[toDataset]]

information screenshot

The defect appears to be a subtle interaction bug between Information and Dataset since expressions like the following do not exhibit the bug:

DownValues[toDataset]

(*
{HoldPattern[toDataset[table_List]]:>
   Dataset[Association/@Function[r,(Thread[First[r]->#1]&)/@Rest[r]][table]]}
*)

Update

The problem is more general than within the context of Information. Both of the following expressions also generate many warning messages:

Unevaluated @ Dataset @ (* ...expr from question... *)

Defer @ Dataset @ (* ...expr from question... *)

Furthermore, there appears to be an evaluation leak involved:

Unevaluated @ Dataset[Print["leak!"]]

evaluation leak screenshot

Defer @ Dataset[Print["leak!"]]

evaluation leak screenshot

This behaviour is very much like what happens with Graphics objects. The front-end attempts to render them in output cells, which implies evaluation:

Defer@Graphics[Print["leak!"]]

Graphics leak screenshot

We might just have to live with this behaviour in both cases (although a way to turn it off would be useful, just as the debugger allows for graphics).


A work around seems to be to not have Dataset as the first Head encountered...

toDataset[table_List]:=Dataset@@{Association/@(Function[r,Thread[First[r]->#]&/@Rest[r]]@table)};

So the first Head the parser sees is Apply and not Dataset.