Project

General

Profile

Actions

Feature #15983

closed

Can we have a similar syntax (string interpolation) the way V language has?

Added by mechanicles (Santosh Wadghule) over 2 years ago. Updated over 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:93527]

Description

Sorry, guys, This is the first feature that I am writing in this Ruby issue tracking system, and If I make any mistake, please understand :).

Today I was going through this language, i.e. V language (mainly their website) and found its basic code like below,

fn main() {
    areas := ['game', 'web', 'tools', 'science', 'systems',
              'embedded', 'GUI', 'mobile'] 
    for area in areas {
        println('Hello, $area developers!')
    }
}

I like this kind of string interpolation which looks so simple to write. If we try to write the same code in Ruby, we need to write like this,

areas = ['game', 'web', 'science', 'system']

areas.each do |area|
  puts "Hello, #{area} developers!"
end

Instead of using #{area} syntax for string interpolation, can we have something like $area? This might save some keystrokes.

I know that Ruby has already occupied this $ character. But we can use another character which is not used in Ruby.

We can close this feature request if we already discussed on such topic before.

Actions

Also available in: Atom PDF