Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange behavior of %A format with non-public discriminated unions

Tags:

f#

The output of:

type Test =
  | First
  | Second
  | Third

let test = First

printf "test=%A" test

is

test=First

as expected, but if I declare the type internal:

type internal Test =
  | First
  | Second
  | Third

let internal test = First

printf "test=%A" test

the output becomes:

test=FSI_0019+Test

Is this by design? Why? Or a bug?

I am using Visual Studio 2010 with F# 2.0

like image 624
MiMo Avatar asked Feb 09 '13 22:02

MiMo


1 Answers

To print non-public members use the '+' flag. The fact that it is missing in MSDN looks like doc issue:

printf "test=%+A" test
like image 124
desco Avatar answered Nov 15 '22 10:11

desco