
Ruby 2.4.0-preview1 released - base
https://www.ruby-lang.org/en/news/2016/06/20/ruby-2-4-0-preview1-released/
======
danso
I've spent the past couple weeks thinking about what framework I want to use
to build static sites. I've primarily used Middleman, or Jekyll when working
with collaborators (think of Middleman as Jekyll but with no restrictions --
i.e. You don't have to use Liquid and you can write plain old Ruby objects and
include them as with a typical full-stack app).

I used to do Ruby because of Rails work...now I do my work exclusively in
Python and Node. I thought it'd be worthwhile to move to a new framework just
so I don't have to juggle so many languages on a daily basis. Lektor (Python)
is exciting and I'll check it out as a way to build client sites...but it's
not quite as flexible as Middleman (to be fair, Lektor is very new)...Pelican
looks good as well...but for now, I think Middleman hits the perfect spot for
speed of deployment and hackability (it recently extricated itself from
sprockets so that you can incorporate webpack.js or whatever asset build
system you like), even accounting for Middleman's and Ruby's slow speed of
execution versus the hugely popular Hugo (static framework in Go)

The truth of it is, is that once you've picked up Ruby, nothing feels quite as
nice as a scripting glue language. I haven't kept up much with updates to the
language...all I know is that yesterday, I finally updated my Ruby environment
manager (rbenv)...it had been 2 years...and changed my system Ruby to 2.3.1
(from 2.1.5)...I had to update a few version numbers for dependencies, but
otherwise, all of my old projects worked with barely a hitch...and it took me
no time to get into writing custom plugins for my next Middleman site.

It does seem that the excitement over Rails and Ruby has ebbed, if you look at
Github stats and Stackoverflow's latest survey. I am curious to see where the
language can go from here, or how it can make a strong niche for itself
besides Rails. but of all the "old" languages that I sometimes have to come
back to, Ruby has been the most welcoming.

~~~
skewart
> The truth of it is, is that once you've picked up Ruby, nothing feels quite
> as nice as a scripting glue language.

I today agree. Ruby is amazing as a light scripting language - heck, I think
it's pretty great as an all-around language, but quick glue scripts are where
it really shines.

I wouldn't be sad to see it fade in popularity if it weren't for the fact that
the language(s) and/or ecosystems eclipsing it are so, well, lame. For a
profession that demands so much careful, reasoned thought software engineers
as a whole can be incredibly irrational.

~~~
CGamesPlay
> the language(s) and/or ecosystems eclipsing it are so, well, lame. For a
> profession that demands so much careful, reasoned thought software engineers
> as a whole can be incredibly irrational.

How do you reconcile an unsupported "lame" without being "irrational"? Do you
have technical reasons they're lame?

~~~
skewart
Haha, good point.

I don't have time to go into much depth right now, but basically the ascendent
languages don't seem to offer many compelling technical advantages. For
example, I've yet to hear a compelling reason why JS makes a better serverside
language than Ruby for most use cases. To be fair, Node and some of the JS
libraries for a long time offered advantages over the Ruby ecosystem for
things like websockets (EventMachine used to swallow stack traces in a really
annoying way). But that has more to do with the ecosystem than the languages
themselves.

I think part of the problem had to do with how dominant Rails was/is in Ruby.
I wish a framework that better catered to emerging app design trends had
gotten traction in Rubyland in, say, 2012.

As for specific complaints about JS, well, it's a perfectly fine language, but
I don't think it's an improvement in any way over Ruby. It has a number of
quirks and compromises - prototype inheritance, basically no support for
modules, clumsy typing, to name a few - which people have been patching over
and working around in lots of different ways over the years. You end up with a
forest of different solutions to things that wouldn't have been a problem in
other languages. Now some fairly dramatic changes are being introduced, which
is probably good, but it means the ecosystem is even more complicated. Working
with the JS ecosystem feels like working with a poorly maintained legacy
codebase - there are lots of places where people have come up with workarounds
to things that shouldn't have been a problem in the first place; it makes you
tired just thinking about all the mental energy spent solving all the little
unnecessary problems.

------
fsiefken
nice, what's keeping
[http://www.isrubyfastyet.com/](http://www.isrubyfastyet.com/) from updating
the charts to > 2.2?

~~~
wasd
Check out RubyBench. [https://rubybench.org](https://rubybench.org)

~~~
fsiefken
yes, really nice. I see there is a Discourse benchmark script, each Rails/Ruby
project (like for example GitLab) could benefit from having this benchmark run
with each minor version increment.

------
tcopeland
I am still surprised by this behavior change from 2.2.3 to 2.3.0 (and also
present in 2.3.1 and 2.4.0):

    
    
      $ ./ruby -e "puts RUBY_DESCRIPTION ; rand(BasicObject.new)"
      ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
      -e:1:in `rand': undefined method `begin' for #<BasicObject:0x007fe0be4cb548> (NoMethodError)
    	from -e:1:in `<main>'
    

In 2.2.3 you get this, which I'd expect:

    
    
      $ ./ruby -e "puts RUBY_DESCRIPTION ; rand(BasicObject.new)"
      ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
      -e:1:in `rand': undefined method `respond_to?' for #<BasicObject:0x007fa2d719bf78> (NoMethodError)
    	from -e:1:in `<main>'
    

It's as if rb_obj_respond_to changed... I don't understand it.

~~~
tvon
I think you're looking in the wrong place, `BasicObject` has no `respond_to?`
so you'd need to trace the `rand_random` execution to see what ends up calling
`respond_to?` on your `BasicObject` instance. Poking through github I'm
guessing it's `rb_funcallv_public` but I may be missing something(s).

~~~
tcopeland
But that's just it; I would have thought the NoMethodError would have been
around the missing "respond_to?" \- like it was in 2.2.3 - not around a
missing "begin".

~~~
mnarayan01
Like @tvon, I'm not up to digging through the code, but I'd guess it's falling
through to eventually make an unconditional call to [http://ruby-
doc.org/core-2.3.0/Range.html#method-i-begin](http://ruby-
doc.org/core-2.3.0/Range.html#method-i-begin).

~~~
tcopeland
That's exactly right; but that's happening because vm_respond_to is returning
true on a nil method entry. It's a puzzler...

~~~
mnarayan01
I assume you mean at
[https://github.com/ruby/ruby/blob/v2_3_0/vm_method.c#L1915-L...](https://github.com/ruby/ruby/blob/v2_3_0/vm_method.c#L1915-L1919).
Agreed it's weird that rb_respond_to will now return true for objects where
respond_to is undefined. Though I guess I can see upsides to doing so, and it
would require something pretty weird to result in "wrong" behavior.

~~~
tcopeland
Yup that's the code that I'm wondering about.

The case I ran into was in a Rails 4.1 app where ActiveSupport::Duration
(which subclassed BasicObject) was used like this: "rand(10.minutes)". That
raised an exception in 2.3.0 but worked fine in 2.2.3. The fix was simple -
"rand(10.minutes.to_i)". But still, I don't understand it.

~~~
mnarayan01
Heh...I also ran into an issue with ActiveSupport::Duration, though in my case
when passed as the only argument to a method with a signature along the lines
of `f(time = 30, [star][star]options)`, with the error involving #to_hash.
Since newer versions of ActiveSupport fix it, I didn't look into it too
careful (just called #to_i). I'm glad you did!

~~~
tcopeland
Ah ha! It was a Ruby bug... longer writeup here:

[http://thomasleecopeland.com/2016/06/26/basicobject-is-a-
ran...](http://thomasleecopeland.com/2016/06/26/basicobject-is-a-range.html)

------
mrmondo
As someone that really appreciates overlayed comparative graphs has anyone
visualised some common benchmarks yet

*edit: interesting HN site bug, I hit edit to update some autocorrect mistakes and rather than updating my comment it added a fresh one - but not the second time. Interesting.

------
desireco42
That is fast, I barely started using 2.3.0 in my projects. Not following
closely what is added but have impression that rate of change in ruby land is
picked up significantly.

~~~
bdcravens
They're on a predictable cycle: minor version release every December 25. (so
2.4.0 final will be released December 25, 2016; which is why they're calling
it "early" as the many features may need more testing)

