Live data from Hacker News

Ruby 2.5.0 Released

ruby-lang.org

71–80 of 113 posts

Re: Ruby 2.5.0 Released

#71
post #31

Earlier quoted context omitted.

See, expressive I totally get. Absolutely. But elegance? Don’t understand that one. Ruby is a cluster of inelegant and over concise cludges in the name of expressivity. The fact that it was once most famous for one of the most inelegant hacks - monkey patching - as a core feature speaks to that. So I totally understand that it’s quick, it’s expressive, and it’s easy to prototype in. Agreed. It’s lost a lot of it’s sh…

Disagree 1000%. Just because you can write a monstrosity in Ruby doesn’t make the language itself inelegant. Ruby, of the many languages I’ve used, has by far the highest potential for code being poetry. You can find solutions that are incredibly simple and understandable due to so much boilerplate being remove from the syntax. Likewise you can write code that’s impressively concise without being inscrutable — I’m co…

Are you familiar with Rust, Haskell, C# or JavaScript?

All of these allow creating new extension methods of existing types, albeit by three different methods.

I'm assuming that your "2001.to_year - 1" is "the date time for 2001 minus 1 day"

rust (traits)

    (pow::(2u8, 1000).digits().sum()
    (2..10_000).amicable_numbers().sum()
    1901.to_year().upto(2001.to_year() - 1.to_day()).days().iter().filter(|d| d.mday + d.wday == 1).count()

Haskell (type classes)

    sum . digits $ 2 ^ 1000
    sum $ amicable_numbers [2..10000]
    count $ filter (\d -> mday d + wday d == 1) [year 1901 .. year 2000 - day 1]

C# (extension methods)

    BigInteger.Pow(2, 1000).digits().sum()
    Enumerable.range(2,10000).amicable_numbers().sum()
    1901.ToYear().UpTo(2001.ToYear() - 1.ToDay()).Days().Where(d => d.mday + d.wday == 1).Count()

JavaScript (changing prototypes)

    bigInt(2).pow(1000).digits().sum()
    _.range(2, 10000).amicable_numbers().sum()
    1901.to_year().upto(2001.to_year().minus(1)).days().filter(d => d.mday + d.wday === 1).length()

Re: Ruby 2.5.0 Released

#72
post #7

I started using Ruby only in April this year due to starting at a new job. Having used and/or dabbled in C, Java, Python and Haskell before (amongst others), I find it super interesting to see how Ruby manages to take some interesting parts from each and manages to integrate it into a very pleasant programming experience. Also the rspec testing library is nothing short of magic, none of the compiled languages have an…

While rspec is indeed nice, I don't get why most projects don't use minitest more. Minitest ships with the Ruby standard library and I much prefer the assert syntax over the rspec DSL. Rails also uses minitest with fixtures by default, I migrated to it recently and I really like the simplicity.

minitest also provides a spec-style DSL. Rspec is a hog, minitest is much, much cleaner and leaner, even if you use the DSL.

Re: Ruby 2.5.0 Released

#73
post #70

Earlier quoted context omitted.

Practical Object-Oriented Design in Ruby by Sandi Metz. http://www.poodr.com/

Thanks. Rubiest here for a decade and hadn't heard of it.

Same. I’ve seen Sandi speak and had a beer with her at Goruco like 10 years ago. Great speaker to be sure.

I’ve never encountered anyone as passionate as @pka suggests. Perhaps POODR is popular where they work but it’s far from universal amongst rubyists.

Re: Ruby 2.5.0 Released

#74
There's no such thing as a perfect language, but Ruby is a very nice one, and the community is just such fun. The tradition of major version releases on Christmas Day each year is one of my favorite things!

Cheers to Matz and all the Ruby contributors :)

Re: Ruby 2.5.0 Released

#77
post #61
post #46

Earlier quoted context omitted.

I started a new contracting gig a couple of months ago, in Ruby. I had used it briefly years before in another project, but it was so long ago that I had to learn it again basically from scratch. Although I don't really think the language is anything special (i.e. it's a standard dynamic OO language), what really turns me off Ruby is this dogmatic, almost religious aspect of its community. Take POODR - it's more or l…

Huh... didn't even know what POODR was... Guess I've been faking it for the past nine years... I mean, I did start a company that used Ruby/Rails as the primary platform. And I've worked the last six years in a shop that currently has a team of about 12 Ruby/Rails developers... Don't get me wrong, Ruby's a tool in my toolbox; I use it like I would any other tool. I like solving problems. Most modern languages make it…

It's not just you. I've been running a company on Rails for four years - never heard of that book.

Re: Ruby 2.5.0 Released

#78
post #31

Earlier quoted context omitted.

See, expressive I totally get. Absolutely. But elegance? Don’t understand that one. Ruby is a cluster of inelegant and over concise cludges in the name of expressivity. The fact that it was once most famous for one of the most inelegant hacks - monkey patching - as a core feature speaks to that. So I totally understand that it’s quick, it’s expressive, and it’s easy to prototype in. Agreed. It’s lost a lot of it’s sh…

Disagree 1000%. Just because you can write a monstrosity in Ruby doesn’t make the language itself inelegant. Ruby, of the many languages I’ve used, has by far the highest potential for code being poetry. You can find solutions that are incredibly simple and understandable due to so much boilerplate being remove from the syntax. Likewise you can write code that’s impressively concise without being inscrutable — I’m co…

> Sure, these depended upon injecting new methods into core classes, but who cares?

I, as a developer reading your code 6 months later, care.

When something fails, it's nearly impossible which of the magic methods were injected by which magic library.

Re: Ruby 2.5.0 Released

#80
post #31

Earlier quoted context omitted.

Disagree 1000%. Just because you can write a monstrosity in Ruby doesn’t make the language itself inelegant. Ruby, of the many languages I’ve used, has by far the highest potential for code being poetry. You can find solutions that are incredibly simple and understandable due to so much boilerplate being remove from the syntax. Likewise you can write code that’s impressively concise without being inscrutable — I’m co…

> Sure, these depended upon injecting new methods into core classes, but who cares? I, as a developer reading your code 6 months later, care. When something fails, it's nearly impossible which of the magic methods were injected by which magic library.

Not really. It's hard for your editor to do this statically, but there's heaps of good tooling for finding the method source and docs dynamically.

  pry> show-source SomeClass.class_method
  pry> show-source AnotherClass#instance_method
  # List an arbitrary object's class methods, instance methods, methods mixed in by included modules
  pry> cd some_object
  pry> ls
The runtime knows how to execute your program (it's not random) so everything you want to know is available.
Post reply on HN