[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:66594] [ruby-trunk - misc #10541] Remove shorthand string interpolation syntax
From:       plasticchicken () gmail ! com
Date:       2014-11-30 20:16:30
Message-ID: redmine.journal-50211.20141130201630.f3b174f48f9e9ffa () ruby-lang ! org
[Download RAW message or body]

Issue #10541 has been updated by Brian Hempel.


I analyzed the ~150,000 Ruby files in the top 1000 Ruby repositories on GitHub:

The regular interpolation syntax is used 353,199 times.
The shorthand interpolation syntax is used 1,376 times.

In percentages, that's 99.6% vs 0.4%. The regular syntax is 250 times more common.

Full results for all Ruby Ripper things: \
https://gist.github.com/brianhempel/ebaae6615c177ab1a509

Abbreviated script used:

~~~ruby
RUBY_FILES = Dir.glob("**/*.rb")

frequencies = Hash.new(0)

RUBY_FILES.each do |path|
  sexp = Ripper.sexp(File.read(path))

  next unless sexp # a few files do not parse
    
  parts = sexp.flatten.grep(Symbol)

  parts.uniq.each do |sym|
    frequencies[sym] += parts.count(sym)
  end
end
~~~

----------------------------------------
misc #10541: Remove shorthand string interpolation syntax
https://bugs.ruby-lang.org/issues/10541#change-50211

* Author: Daniel Morrison
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: syntax
* Target version: current: 2.2.0
----------------------------------------
I would like to see the shorthand string interpolation syntax, "foo#@bar" deprecated \
and then removed in 3.0.

My reasons:

1. Most experienced Ruby developers I've talked to don't even know it exists.
2. It has been the cause of real problems. \
http://status.cloudamqp.com/incidents/vj62pnp62tj9

When a syntax is not widely known and has the potential for problems, I think it \
makes sense to deprecate and remove. 



-- 
https://bugs.ruby-lang.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic