printf - Why is F# printfn not implemented in terms of Console.WriteLine? -
i noticed unexpected behavior when using f# printfn. seems break format string chunks , call console.write multiple times each call printfn. expect format entire string , call console.writeline once.
i noticed because intercepting standard console output using console.setout call own textwriter tries prefix every line of output time stamp , additional custom text.
what gives?
here's guess, it's worth:
- compiler magic
- at runtime, implementer knew write go buffered stream, performance won't drastically different using stringbuilder object , tostring() override. maybe performance better, since avoided object allocation.
Comments
Post a Comment