This post reminds me of something. During my first Introduction to Programming course at university, I was taught Java. One thing that I found very troubling is that it wasn't easy, or possible in many cases, to change the programming language. Sure, you can write new functions or methods or classes, but I can't change the keyword for an if-statement. I also remember the TA saying "why would you want that?" I caught…
> I also remember the TA saying "why would you want that?" Is a typical response of someone without the background and without the imagination. It may well be, that doing Java-only for too long robs one of both. An alternative response could have been: "What a fascinating idea! How would you apply that? / What would you do with that?" I am happy for you, that you found the exceptions and that your picture of the comp…
Do I not like Ruby anymore? (2024)
21–30 of 184 posts
Re: Do I not like Ruby anymore? (2024)
#22It's the never ending "end"s that bother me about Ruby. class Mess def chaos(x) if x > 0 [1,2,3].each do |i| case i when 1 if i.odd? puts "odd" else puts "even" end when 2 begin puts "trying" rescue puts "failed" end else puts "other" end end else puts "negative" end end end Clear away all those ends and the program logic pops out. Much fresher! class Mess: def chaos(self, x): if x > 0: for i in [1, 2, 3]: match i: c…
Re: Do I not like Ruby anymore? (2024)
#23This post reminds me of something. During my first Introduction to Programming course at university, I was taught Java. One thing that I found very troubling is that it wasn't easy, or possible in many cases, to change the programming language. Sure, you can write new functions or methods or classes, but I can't change the keyword for an if-statement. I also remember the TA saying "why would you want that?" I caught…
Too much change isn't good though. There's value in consistent basics. I've seen people doing things like: #define BEGIN { #define END } because they liked Pascal, and that way lies madness.
Flashbacks to scala operator PTSD.
No. I don't want to use ++^^%% operator! I am not a number! I'm a man!
Re: Do I not like Ruby anymore? (2024)
#24Re: Do I not like Ruby anymore? (2024)
#25I feel the samw, happy that Python is improving and getting more good tooling
Re: Do I not like Ruby anymore? (2024)
#26It's the never ending "end"s that bother me about Ruby. class Mess def chaos(x) if x > 0 [1,2,3].each do |i| case i when 1 if i.odd? puts "odd" else puts "even" end when 2 begin puts "trying" rescue puts "failed" end else puts "other" end end else puts "negative" end end end Clear away all those ends and the program logic pops out. Much fresher! class Mess: def chaos(self, x): if x > 0: for i in [1, 2, 3]: match i: c…
class Mess
def chaos(x)
if x > 0
[1, 2, 3].each do |i|
case i
when 1
if i.odd?
puts "odd"
else
puts "even"
end
when 2
begin
puts "trying"
rescue
puts "failed"
end
else
puts "other"
end
end
else
puts "negative"
end
end
end
I would have done it this way instead class Mess
def chaos(x)
if x > 0
[1, 2, 3].each do |i|
case i
when 1
puts i.odd? ? "odd" : "even"
when 2
puts "trying"
else
puts "other"
end
end
else
puts "negative"
end
end
end
Or if you allow me to create a separate private method class Mess
def chaos(x)
return puts "negative" unless x > 0
[1, 2, 3].each { |i| handle_item(i) }
end
private
def handle_item(i)
case i
when 1 then puts(i.odd? ? "odd" : "even")
when 2 then puts "trying"
else puts "other"
end
end
endRe: Do I not like Ruby anymore? (2024)
#27Back when autocompletion and stuff were only available in Visual Studio/Xcode/Other bug IDEs, I was forced to use Ruby and fell in love with it. It didn't matter what I used as my editor was Sublime. But when VSCode came and language features became democratized, I never touched a type-less language again. Why should someone opt for a language with absolutely no features where one can have autocompletion, typecheckin…
If only the Ruby ecosystem had adopted Scala instead of Ruby, with cutesy books and eccentric underscored personalities, history might have been different.
Re: Do I not like Ruby anymore? (2024)
#28I was a full-time Rubyist for a long time. I started the UK's first dedicated Ruby on Rails consultancy in 2006 before Rails was even v1.0 (IIRC the first apps I shipped back then were 0.8.6). I stuck around through the hype chain, and then started to help one employer break up a RoR monolith into micro services and adopt Java and Go (this was a mistake - we should have crafted the monolith better). I've built 4 star…
Anyway, that said, for new personal projects I like typescript and rust. But recently I needed to stick an admin interface on such a project and rails shines there, you can get something good and secure stood up with less code and faff than anything else. In today's world of LLMs that is helpful too, rails is concise and old and has lots of open source projects to pull from, so AI breezes through it.
Re: Do I not like Ruby anymore? (2024)
#29Earlier quoted context omitted.
Doesn't Ruby essentially already have namespaces, in terms of having modules? If one has proper modules, why would one ever need an alternative, weaker, concept for referring to things?
To make sure code loaded from gems doesn’t shadow the namespace of the application.
Ruby 3.5 will introduce a new language keyword "namespace" that scopes behavior to that namespace.
class Foo
def foo; puts "foo"; end
end
namespace Bar
class Foo
def foo; puts "bar"; end
end
Foo.new.foo #=> "bar"
end
Foo.new.foo #=> "foo"
Fun times.This is intended for isolated code loading similar to "modules" in Python or ES6, but I am worried it will be abused badly. I'm also unsure whether they will add a "use Namespace" construct...
See here: https://bugs.ruby-lang.org/issues/21311
Re: Do I not like Ruby anymore? (2024)
#30Initially, the celebrated feature of python was that it allowed easy and fast development for newcomers. There was a joke a long the lines, "I learned python, it was a great weekend".
As much as I like python's type system (and wouldn't want to see them ever go way!), part of me wonders if moving into a world where hello-world can look like this, is a world where python is no longer the "lean in a weekend" language:
from typing import Annotated
import typer
app = typer.Typer()
@app.command()
def main(
name: Annotated[str, typer.Option("--name", "-n")],
) -> None:
"""Prints out 'HELLO {name}!!' (name upper cased) to the console"""
print(f"HELLO {name:upper}!!")
if __name__ == "__name__":
app()
(obviously the example is silly, and I know this is a lot more than you need to do, hopefully you get my point though!)