Skip to content

Commit 53c25f7

Browse files
committed
Mark print and println as inline
Allows the string call to specialize for certain types and avoid unnecessary .ToString() calls.
1 parent f27d2dd commit 53c25f7

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/FSharp.Core/fslib-extra-pervasives.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ module ExtraTopLevelOperators =
278278
Printf.eprintfn format
279279

280280
[<CompiledName("PrintValue")>]
281-
let print (value: 'T) =
281+
let inline print (value: 'T) =
282282
Console.Out.Write(string value)
283283

284284
[<CompiledName("PrintValueLine")>]
285-
let println (value: 'T) =
285+
let inline println (value: 'T) =
286286
Console.Out.WriteLine(string value)
287287

288288
[<CompiledName("DefaultAsyncBuilder")>]

src/FSharp.Core/fslib-extra-pervasives.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module ExtraTopLevelOperators =
6868
/// </code>
6969
/// </example>
7070
[<CompiledName("PrintValue")>]
71-
val print: value: 'T -> unit
71+
val inline print: value: 'T -> unit
7272

7373
/// <summary>Converts the value to a string using the <c>string</c> operator and writes it to the standard output, followed by a newline.</summary>
7474
///
@@ -81,7 +81,7 @@ module ExtraTopLevelOperators =
8181
/// </code>
8282
/// </example>
8383
[<CompiledName("PrintValueLine")>]
84-
val println: value: 'T -> unit
84+
val inline println: value: 'T -> unit
8585

8686
/// <summary>Print to a string using the given format.</summary>
8787
///

0 commit comments

Comments
 (0)