You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -114,6 +115,29 @@ See [Name mangling](/docs/javascript/features.html#name-mangling) for more infor
114
115
- Numeric arrays are compiled to [Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) when possible.
115
116
- No bound checks for numeric types (unless you do explicit conversions like `byte 500`) nor for array indices.
116
117
-`Regex` will always behave as if passed `RegexOptions.ECMAScript` flag (e.g., no negative look-behind or named groups).
118
+
-`ConditionalWeakTable` has some limitations: the `GetOrCreateValue` method is not supported, nor is casting it to `IEnumerable` and iterating it. If you want to use a string as a key, you must manually box it in a JS `String` object:
119
+
120
+
```fsharp
121
+
open System.Runtime.CompilerServices
122
+
123
+
// Only needed for strings as keys; other reference types work fine directly
124
+
let inline boxString (str: string): obj =
125
+
#if FABLE_COMPILER
126
+
Fable.Core.JsInterop.emitJsExpr (str) "new String($0)"
127
+
#else
128
+
box str
129
+
#endif
130
+
131
+
let table = ConditionalWeakTable()
132
+
let key = boxString "my-key"
133
+
let value = "something"
134
+
table.Add(key, value)
135
+
136
+
// Use the same `key` object later to get the value..
0 commit comments