fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

FSI pretty print of values shows the same text for records and anonymous records

Open cartermp opened this issue 7 years ago • 2 comments

The following code:

type Phillip = { Name: string; Age: int}
let p = { Name="Phillip"; Age=28}
let ap = {| Name="Phillip"; Age=28 |}

Prints values in FSI that are identical:

image

The types are pretty-printed correctly as you would expect.

cartermp avatar Jan 16 '19 16:01 cartermp

BTW, it looks like FSI prints it very different to current formatting conventions. Should I fire a separate issue trying to list such cases?

auduchinok avatar Jan 16 '19 17:01 auduchinok

So I believe FSI uses reflection, at which point the values are all the same. However in the case of the anonymous record it prints in alphabetical order.

A way to distinguish an anonymous record is that it uses a SHA-1 as the actual name under the covers. Perhaps that could be an indicator.

cartermp avatar Jan 16 '19 21:01 cartermp