Skip to content

Commit 0bd3211

Browse files
committed
fix comment
1 parent f96890a commit 0bd3211

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Compiler/Utilities/lib.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ module WeakMap =
466466
/// is strongly referenced elsewhere (backed by ConditionalWeakTable).
467467
///
468468
/// Usage:
469-
/// let getValueFor = WeakMap.getOrCreate (fun () -> expensiveInit())
469+
/// let getValueFor = WeakMap.getOrCreate (fun key -> expensiveInit key)
470470
/// let v = getValueFor someKey
471471
let getOrCreate valueFactory =
472472
let table = ConditionalWeakTable<_, _>()

src/Compiler/Utilities/lib.fsi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,13 @@ module Async =
297297
val map: ('T -> 'U) -> Async<'T> -> Async<'U>
298298

299299
module internal WeakMap =
300-
/// Attach a value to arbitrary keys using a ConditionalWeakTable.
301-
/// Each distinct key gets its own value produced by createValue().
302-
/// The value is lazily created and stays alive only as long as the key is strongly referenced elsewhere.
300+
/// Provides association of lazily-created values with arbitrary key objects.
301+
/// The associated value is created on first request and kept alive only while the key
302+
/// is strongly referenced elsewhere (backed by ConditionalWeakTable).
303+
///
304+
/// Usage:
305+
/// let getValueFor = WeakMap.getOrCreate (fun key -> expensiveInit key)
306+
/// let v = getValueFor someKey
303307
val internal getOrCreate:
304308
valueFactory: ('Key -> 'Value) -> ('Key -> 'Value)
305309
when 'Key: not struct and 'Key: not null and 'Value: not struct

0 commit comments

Comments
 (0)