I suggest we ...

Add string interpolation to println syntax (from Swift)

The new language from Apple, Swift has a really nice syntax for println:
http://en.wikipedia.org/wiki/Swift_(programming_language)

let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25]
for (name, age) in people {
println("\(name) is \(age) years old.")
}

We could steal the idea but use % instead of \ for a better fit. It would also be compatible, and combinable (is that a word?) with existing printfn syntax:

let name = "Robert"
printfn "Hi %(name), your age is %d"
printfn : int -> string

Naturally there would be compiler errors if name does not exist.

179 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Robert Jeppesen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    19 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      F# Language

      Feedback and Knowledge Base