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
Really neat language! Would adding support for Interpolated Strings be difficult?
Building strings can get wordy using the + operator (pun intended): "The area of interest is bounded by " + p1.X + "," + p1.Y + " and " + p2.X + "," + p2.Y + "."
IMO, having the values inlined instead of at the end (like string.format) makes it easier to read.
Possible suggested styles:
C#6
$"The area of interest is bounded by {p1.X}, {p1.Y} and {p2.X}, {p2.Y}"
Javascript
'The area of interest is bounded by ${p1.X}, ${p1.Y} and ${p2.X}, ${p2.Y}'
Swift
'The area of interest is bounded by \(p1.X), \(p1.Y) and \(p2.X), \(p2.Y)'
The text was updated successfully, but these errors were encountered:
Hey, thanks! Agree that it'd be awesome to have. Don't really have a preference for syntax but I do like JavaScript's tagged templates.
Implementation shouldn't be too bad - the most complicated part might be the lexer changes required. It'll need to save its state upon reaching ${ and then return to being a string when it reaches the matching }. And handle nested string interpolation, of course!
If you're up for it just let me know if you need help with anything.
I agree tagged templates are very nice. However, I can't see myself using them for everyday strings. I'm testing Mond using lots of user facing strings.
A related use case for me is for localization. Positional arguments string.format is helpful, but named arguments would be better. However, that is kind of out of scope for the base language. Having, good string handling is key for writing higher level sentence generation.
I'll try implementing one of the basic interpolation strings first to learn the internals of Mond. Thanks.
Really neat language! Would adding support for Interpolated Strings be difficult?
Building strings can get wordy using the + operator (pun intended):
"The area of interest is bounded by " + p1.X + "," + p1.Y + " and " + p2.X + "," + p2.Y + "."
IMO, having the values inlined instead of at the end (like string.format) makes it easier to read.
Possible suggested styles:
C#6
$"The area of interest is bounded by {p1.X}, {p1.Y} and {p2.X}, {p2.Y}"
Javascript
'The area of interest is bounded by ${p1.X}, ${p1.Y} and ${p2.X}, ${p2.Y}'
Swift
'The area of interest is bounded by \(p1.X), \(p1.Y) and \(p2.X), \(p2.Y)'
The text was updated successfully, but these errors were encountered: