From: duerst@...
Date: 2019-07-04T06:23:31+00:00
Subject: [ruby-core:93528] [Ruby master Feature#15983] Can we have a similar syntax (string interpolation) the way V language has?
Issue #15983 has been updated by duerst (Martin D�rst).
There are other languages that use $ in string interpolation. One of them is Perl. Perl is much more famous and widely used than V. Ruby was created as a better Perl. $variable_name may work (most of the time, but not always) in languages with spaces between words, but it doesn't work well in a language that's written without spaces, such as Japanese. My guess is that this is one of the reasons for why Matz choose an explicit terminator ('}') for interpolations.
----------------------------------------
Feature #15983: Can we have a similar syntax (string interpolation) the way V language has?
https://bugs.ruby-lang.org/issues/15983#change-79090
* Author: mechanicles (Santosh Wadghule)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
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,
```ruby
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,
```ruby
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.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>