Is this just about making ruby more like node (substituting callbacks for promises)?
Also, do all of these features really need to be implemented on the interpreter level?
It is also about wiping the slate clean. Ruby still has some ugly stuff inherited from Perl (globals for regex results, or the use of unreadable "magical" globals such as $:). There are many areas where years of experience can help us design a better language.
And Ruby also has some pretty stuff inherited from Perl like postfix statements & first class regex so it wouldn't be good to strip out all of Perl's influences! Gosh even Ruby's blocks are (partly) inspired by Perl's list block functions...
array.map {|n| n * 2}
map {$_ * 2} @array;
However I do agree that Ruby's magical global variables should be removed because they're not dynamically scoped like in Perl.NB. It should be noted that not all Ruby magical variables even come from Perl. For eg. $: doesn't and thankfully Perls $= does something quite different to Rubys! - https://news.ycombinator.com/item?id=5072925
How will this turn out? Matz will approve it? If yes why not make Rubinius the default implementation?
If not, then ?
To some guy slamming out Java in a bank where you have to wear a suit and tie or PHP in some chop shop where version control is on the distant TO-DO list, Ruby programmers do look like brogrammers with their fancy tools and fancy computers.
discussion: https://news.ycombinator.com/item?id=6553767
Personally I believe in "the best tool for the job".
> Gone. Period.
That's pretty extreme. What is supposed to replace them?
module Foot
@size = 10
class << self
attr_accessor :size
end
end
Foot.size = 8
ActiveSupport gives you "mattr_accessor" and "class_attribute" to accomplish the same thing with less code.In my opinion, class/module-level attributes are useful enough that it ought to be provided by the language itself.
Edit: Come to think of it, most people, that I have seen, use globals to set constants. That currently has perfectly good syntax:
module Foot
SIZE = 10
end
print Foot::SIZE module Foo
class << self
attr_accessor :bar
end
end
Foo.bar = "baz"So why base this on Ruby? Because the syntax is nice? Perhaps it would be better to start with something like elixir, which has a syntax based on Ruby, works with existing Erlang libraries and has good (perhaps excellent) support for concurrency and immutability.
I think it's great.
All that said, this simplifies the language spec and implementation by eliminating features that have long been on-the-outs in the Ruby community. Note that the proposals on that page don't break regexes, they just break code that uses the old Perl-esque $1, etc. magic variables. This is almost mechanically trivial to port to use Regexp methods, MatchData, etc. IME, it's rare to see this used in Ruby code in the wild. I find it kind of startling when it does show up.