Semantic Diff

#9518 PoC: replace @as(json) arguments in the stdlib with @inline functions

1 commit

516009a2f3eccac7d6e4fc497cfd8e71871e6bd2..pr-9518

4d2973cff · cknitt + Claude · Dec 03, 2026, 19:19 UTC

Pass the constant arguments of Dict and Object functions without @as(json)

Why

A prototype for deprecating @as(json) on external arguments. The seven stdlib uses become an external that takes the constant plus an @inline function of the same name that passes {} or null, the way Array.reduce reorders its arguments. Calls compile to the same JavaScript as before.

JS unchanged (call sites):

let merged = target->Dict.concat(dict{"b": 3})let bare = Object.createWithNull()
js
Before and After are equal
let merged = Object.assign({}, target, {  b: 3}); let bare = Object.create(null);

Review

  • What changes for users? Stdlib_Dict.js and Stdlib_Object.js now export these functions, as Stdlib_Array.js exports reduce. A function value such as Dict.copy passed around calls the exported function instead of a wrapper made at the use site.