F # line operator breaks on guides

It seemed to me that in F # the following two lines should give the same results:

let a = string v
let a = v.ToString()

V is assumed to be an object. It turns out if v is System.Guid, the first line just throws an exception:

System.FormatException occurred
Message="Format String can be only \"D\", \"d\", \"N\", \"n\", \"P\", \"p\", \"B\" or \"b\"."
Source="mscorlib"
StackTrace:
   at System.Guid.ToString(String format, IFormatProvider provider)
InnerException: 

I can, of course, deal with the Guides separately, the question is, what other objects will give me the same problems? Should I avoid using the string operator at all? In my case, the object could potentially be any

+3
source share
1 answer

This is a bug that (will) be fixed in the next version.

( , , - , System.Guid IFormattable "G", , IFormattable , "G". System.Guid, F # "" .

, , Guid , . .)

+8

Source: https://habr.com/ru/post/1726094/


All Articles