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
If so, how does this proposal differ?
This proposal defines different syntax
Does this affect error handling?
No
Is this about generics?
No
Proposal
What is the proposed change?
This proposal adds way to interpolate values to string other than fmt.Printf, concatenation, or others
Who does this proposal help, and why?
This proposal helps to make interpolation simple and don't remember all %something in fmt.Printf
Please describe as precisely as possible the change to the language.
This interpolation use strings, prefixed by hash (#) symbol, they converted to normal strings at runtime, because expressions can vary
What would change in the language spec?
Specification will include information about syntax of this string interpolation
Is this change backward compatible?
Yes
Show example code before and after the change.
Before
a:=5hash:="#"// Simple outputfmt.Printf("%v\n", a)
// Pad charfmt.Printf("%-3v\n", hash)
After
a:=5hash:="#"// You can even not import fmt!// Simple outputprintln(#"{a}")
// Pad char (shows optional formatting)println(#"{[%-3v] hash}")
Orthogonality: how does this change interact or overlap with existing features?
This is new feature
Is the goal of this change a performance improvement?
No
Costs
Would this change make Go easier or harder to learn, and why?
It's makes interpolation in Go easier to learn because of simple syntax
What is the cost of this proposal? (Every language change has a cost).
Implementation of this interpolation
How many tools (such as vet, gopls, gofmt, goimports, etc.) would be affected?
gopls, vet
What is the compile time cost?
Zero
What is the run time cost?
Additional interpolation
Can you describe a possible implementation?
No
Do you have a prototype? (This is not required.)
No
The text was updated successfully, but these errors were encountered:
Author background
Something between novice and intermediate
C#, Python, JS/TS
Related proposals
proposal: Go 2: string interpolation evaluating to string and list of expressions #50554
proposal: Go 2: string interpolation #34174
This proposal defines different syntax
No
No
Proposal
This proposal adds way to interpolate values to string other than
fmt.Printf
, concatenation, or othersThis proposal helps to make interpolation simple and don't remember all %something in
fmt.Printf
This interpolation use strings, prefixed by hash (
#
) symbol, they converted to normal strings at runtime, because expressions can varySpecification will include information about syntax of this string interpolation
Yes
This is new feature
No
Costs
It's makes interpolation in Go easier to learn because of simple syntax
Implementation of this interpolation
gopls, vet
Zero
Additional interpolation
No
No
The text was updated successfully, but these errors were encountered: