3 ms·
This is a well solved problem in languages like JS[0] and C#[1] allowing both plain and customized interpolation. Perhaps they wanted a different implementation
by neonsunset 2y ago
This is a well solved problem in languages like JS[0] and C#[1] allowing both plain and customized interpolation. Perhaps they wanted a different implementation and could not just take after prior art due to politics or culture?
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
[1]: https://learn.microsoft.com/en-us/ef/core/querying/sql-queries#passing-parameters https://learn.microsoft.com/en-us/ef/core/querying/sql-queri...
(example showcases it better than API spec, C# generally lets you take it further to perform zero-allocation interpolation with custom interpolated handlers if you e.g. want to pass interpolated output into a buffer/stream/etc.)