-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support string interpolation #29
base: master
Are you sure you want to change the base?
Support string interpolation #29
Conversation
6c4995a
to
6f098b2
Compare
@@ -185,11 +212,11 @@ struct Log | |||
|
|||
// Helper to allow using named references in format strings, ie. treat %{name} equivalent to %s. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's intended for this idea in the future? Will it be deprecated?
Or does it have to be extended like $foo(42)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was intending for it to correspond to named arguments eventually; I think that's still useful. I'd leave it for now. We need more experience with how interpolated strings and named args look in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to continue with "%{name}"?
6f098b2
to
d38ab58
Compare
d38ab58
to
86326d8
Compare
static if (supportsStringInterpolation) | ||
{ | ||
// Placeholder pending https://issues.dlang.org/show_bug.cgi?id=24550 | ||
private void formattedWrite(Sink, Args...)(ref Sink sink, InterpolationHeader _header, Args args, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicer line break?
private void formattedWrite(Sink, Args...)(ref Sink sink,
InterpolationHeader _header, Args args, InterpolationFooter _footer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make the line break prettier.
Support string interpolation added in DMD 2.108, ie.
log.info(i"The answer is $(42)");
.Older compilers remain supported.