Feature: string interpolation #8
fibodevy
started this conversation in
Ideas / Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
string interpolationEmbed expressions straight into a string literal with
$'...'and{}:{expr}auto-formats by type: scalars pass throughWriteStr, class instances callToString, class refs give the name, arrays unroll into[a, b, c].{expr:mask}routes toFormat/FormatDateTime/FormatFloat/IntToHexdepending on the type and the mask shape. Masks default to the invariant locale; anLprefix opts into the system one.Heads up on a recent change
The format spec used to be
{expr as 'mask'}. It's now{expr:mask}- the mask is the raw text after the colon, no quotes, no escaping. Reads closer to C#/Python and letsaskeep its normal meaning inside{}. Full dispatch table and the rest is in the docs.IDE
The IDE side is ready too on feat/strinterp: SynEdit highlights
$'...'literals and colours the:maskas part of the string, and CodeTools knows the syntax so rename / find-references reach identifiers inside{}and skip past the mask.This is about ready to merge. If you have any objections or want changes, now is the moment - raise concerns and request changes before it goes in.
Beta Was this translation helpful? Give feedback.
All reactions