Live data from Hacker News

Ruby 3.0 Preview 1

ruby-lang.org

191–200 of 207 posts

Re: Ruby 3.0 Preview 1

#191
post #148

Earlier quoted context omitted.

So why would you not just default to always using .size?

You usually want to know when you're hitting the database. "Hit the database if the value isn't cached" is useful behavior, but should probably be telegraphed a bit more precisely than just the word "size".

“size” is fine. The person you are responding to is trying to say that complaining about multiple options is a bit strange as you can just use one option. Why is it an issue that other options exist? Who cares. There are synonyms for English words as well, is that an issue as well?

Re: Ruby 3.0 Preview 1

#193
post #148

Earlier quoted context omitted.

You usually want to know when you're hitting the database. "Hit the database if the value isn't cached" is useful behavior, but should probably be telegraphed a bit more precisely than just the word "size".

“size” is fine. The person you are responding to is trying to say that complaining about multiple options is a bit strange as you can just use one option. Why is it an issue that other options exist? Who cares. There are synonyms for English words as well, is that an issue as well?

They are not synonyms, they mean slightly different things. And that is the problem.

Because for small datasets the difference doesn’t matter this results in beginner programmers choosing randomly, which 2/3 of time is the wrong choice.

Re: Ruby 3.0 Preview 1

#195

>Rightward assignment statement is added. >fib(10) => x This is exactly the kind of stuff I hated when I had to work with ruby in my last gig and why I will never accept a job using it again - soo many pointless and inconsistent ways to do the same thing ... they have method aliases for collection operations like map/filter in standard library ! .NET went with non-standard SQL-like names (select/where) and I'm not a…

Totally agree.Different approaches to the same thing won't add points to the language. P.S. the 'endless method definition' is meaningless, too. > def square(x) = x * x The original reason of this proposal was: > Ruby syntax is full of “end”s. I’m paranoid that the ends end Ruby. I hope Ruby is endless. --mame (Yusuke Endoh) It sounds like "let's add a new syntax for lisp because it has too many brackets"

This is a feature present in Kotlin, and it's useful for mathematical functions and simple-but-not-trivial getters.

Re: Ruby 3.0 Preview 1

#196
post #148

Earlier quoted context omitted.

You usually want to know when you're hitting the database. "Hit the database if the value isn't cached" is useful behavior, but should probably be telegraphed a bit more precisely than just the word "size".

“size” is fine. The person you are responding to is trying to say that complaining about multiple options is a bit strange as you can just use one option. Why is it an issue that other options exist? Who cares. There are synonyms for English words as well, is that an issue as well?

"size" is not fine. If I'm conditionally hitting the database, I want that to be as explicit as possible.

Re: Ruby 3.0 Preview 1

#197

I love Ruby and great to see Ruby love on hacker news. Just curious on how popular it is in the hacker news community ?

I only ever tried out a rails tutorial once, and coming from a C/C++ background, but having used with many languages, too many things felt like magic back then, but no further experience with the language itself, so can’t really judge it. However, now I’m on the operational side of things, and there are 2 types of applications I avoid to deploy/maintain, mainly because of their runtime: Java and Ruby apps. It’s very…

the magic in rails is not really magic once you get used to the fact that all those magic incantations are just method calls inside the class. every class in ruby is just a series of method calls. you can write a class that, when it's read from the file and interpreted will just print something...

class Foo

  puts "bar"
end

will just print `bar` when it's parsed.

so something like has_many :baz are just the method call `has_many(:baz)` defined by active record. that creates a few functions using meta-programming. the other thing that ruby uses a lot of are blocks which are just anonymous functions. `do |a,b,c| puts a; end` just a function passed to the method that can be invoked by the function. I think those things are the ones that trip people up the most with when learning.

Re: Ruby 3.0 Preview 1

#198
post #129
post #120

Earlier quoted context omitted.

> you'd set up standards everyone can agree on and understand with rubocop or prettier-rb Things like that just often lead to bikeshedding. And then worse, powerful voices may approve ideas that work for them and not everyone else, or even more worse crippling a language to be too safe or bland to be truly useful. I got into an argument a couple weeks ago whether an unprotected eval() in python should make it's way i…

That's a problem with culture, not with the language. You can't say "you can get into accidents if you drive a car, so you're not allowed to drive"; you try to fix it by setting rules into place. At any rate, if you don't like bikeshedding, there's great, well appreciated standards in place for ruby which you can take up as-is: there's AirBnB, standard-rb/ prettier-rb and rubocop's default config. No bikeshedding inv…

Which culture are you talking about? Company culture or programming culture?

My understanding was the general bikeshedding around formatting was the reason gofmt won for golang. That seems to hint the problem is a programming wide culture. Just in the same historical context programmers have had around tabs vs spaces...

Re: Ruby 3.0 Preview 1

#199

Earlier quoted context omitted.

Metaprogramming is an important part of ruby, so method_missing stays.

No, metaprogramming is a stain on software engineering that all ecosystems are moving away from. Except Ruby.

Please don't do programming flamewar on HN. It leads to much worse threads.

https://news.ycombinator.com/newsguidelines.html

Post reply on HN