Earlier quoted context omitted.
> I think the Ruby solution is more readable. I disagree and I’ve used both professionally for about the same amount of code.
And yet, in the production Python codebases I've worked with, list comprehensions are rarely seen. Usually it's typical loop iterations. I wonder why that is?...
Ruby 3.2.0 is from another dimension
311–320 of 341 posts
Re: Ruby 3.2.0 is from another dimension
#312Earlier quoted context omitted.
> I think the Ruby solution is more readable. I disagree and I’ve used both professionally for about the same amount of code.
And yet, in the production Python codebases I've worked with, list comprehensions are rarely seen. Usually it's typical loop iterations. I wonder why that is?...
Coming from a point of zero knowledge of the codebase, I picked Flask. I picked the cli.py module in Flask. And what do I find?
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
https://github.com/pallets/flask/blob/main/src/flask/cli.py#...
The keyword "for" occurs twice as often in comprehensions and generator expressions as it does in "typical loop iterations!"
Re: Ruby 3.2.0 is from another dimension
#313Earlier quoted context omitted.
I didn't know Ruby didn't have first-class functions but that's already a massive no for me. You don't need to convince me regarding Python though - it's too convenient to pass up. And despite its shortcomings it's certainly not a language devoid of elegance like some in this thread are painting... Like the old adage goes, there's the languages nobody uses, and there's the languages people talk shit about. Or in simp…
I have no idea what they mean by Ruby not having first-class functions. Of course it does. It's a fundamental feature of the language.
https://en.wikipedia.org/wiki/First-class_function
"The identifier of a regular "function" in Ruby (which is really a method) cannot be used as a value or passed. It must first be retrieved into a Method or Proc object to be used as first-class data. The syntax for calling such a function object differs from calling regular methods."
Why do people like you insist on talking about things you don't actually know about?
Re: Ruby 3.2.0 is from another dimension
#314Earlier quoted context omitted.
Python lambdas are not great but Ruby not having first-class functions is also not great. Neither are perfect and there is no syntactic reason outside of variations of personal taste to choose one language over the other. There are a boatload of compelling reasons to choose Python for its libraries and documentation and adoption level, though.
> Ruby not having first-class functions This is simply false. Ruby has first-class functions. Not only that, it has blocks, which few other languages have. Ruby optimizes for the common use-case of a method that takes a single callback/piece of code, and I miss it in most other languages, including Python. In Python, the "with" statement is super special. But in Ruby, it's just a method that takes a block. And any me…
https://blog.appsignal.com/2018/09/04/ruby-magic-closures-in...
Re: Ruby 3.2.0 is from another dimension
#315Earlier quoted context omitted.
I have no idea what they mean by Ruby not having first-class functions. Of course it does. It's a fundamental feature of the language.
No it does not. Ruby has first-class procs. They are not the same thing. It's a fundamental flaw of the language. It's in the Wikipedia page. https://en.wikipedia.org/wiki/First-class_function "The identifier of a regular "function" in Ruby (which is really a method) cannot be used as a value or passed. It must first be retrieved into a Method or Proc object to be used as first-class data. The syntax for calling such…
You should really consider whether this is an important enough topic to be worth personally insulting people over.
Re: Ruby 3.2.0 is from another dimension
#316Earlier quoted context omitted.
I'm sorry, I agree it is a beautiful language. But Ruby is slow. Performance matters. In a world when everything seems to run in cloud servers, efficiency matters. If you can have 20 times more simultaneous users in the same cloud server by using a different tech stack, there's no reason to keep using Ruby. For the record, I also think Python is generally slow, but it has improved in the latest version, and the impor…
And then there is PHP... which is also insanely fast now compared to even 5 years ago, it is stateless by default, but you can also run application servers in long threads for even more performance. For 2023, the PHP community is seriously committing resources to making this long running scenario more efficient and performant. Except for the ML/AI use case, Laravel has more batteries included I would argue than Djang…
Re: Ruby 3.2.0 is from another dimension
#317Earlier quoted context omitted.
I'm sorry, I agree it is a beautiful language. But Ruby is slow. Performance matters. In a world when everything seems to run in cloud servers, efficiency matters. If you can have 20 times more simultaneous users in the same cloud server by using a different tech stack, there's no reason to keep using Ruby. For the record, I also think Python is generally slow, but it has improved in the latest version, and the impor…
Ruby is no slower than Python, it is actually often faster. And many of the important Ruby libraries are written in C.
And C++20 is actually very nice to use.
In contrast, these two, Ruby and Python, are slogs.
Re: Ruby 3.2.0 is from another dimension
#318Earlier quoted context omitted.
No it does not. Ruby has first-class procs. They are not the same thing. It's a fundamental flaw of the language. It's in the Wikipedia page. https://en.wikipedia.org/wiki/First-class_function "The identifier of a regular "function" in Ruby (which is really a method) cannot be used as a value or passed. It must first be retrieved into a Method or Proc object to be used as first-class data. The syntax for calling such…
The Wikipedia article is wrong. A proc is a function. The misunderstanding here is confusing methods with functions. "def foo" defines a method, not a function. That same article claims that Java has first class functions on the basis of anonymous inner classes, that C# has them because of lambda expressions, etc. OCaml has different syntax for functions and methods. Does that mean it doesn't have first-class functio…
> In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing them in data structures.[1]
OCaml has first-class functions, the names can be passed around as parameters and returned as values. Ruby functions and methods cannot; only Proc objects and Method objects proxying for them can be.
You should really consider whether pointing out your incorrectness constitutes an insult and why you think this is so.
Re: Ruby 3.2.0 is from another dimension
#319Earlier quoted context omitted.
> JS got popular coz, well you ain't got fucking choice on frontend and having your then-frontend JS/HTML/CSS designer be able to also do backend is, well, again, easy and cheap. IIRC, a bigger reason for Node's popularity (at least at the very beginning of its popularity) was the fact that it had event-based I/O, which let a single process handle a lot more in-flight requests than Ruby (where the concurrency model w…
Famous TCL paper from 1995, regarding event based programming. "Why Threads Are A Bad Idea (for most purposes)" https://web.stanford.edu/~ouster/cgi-bin/papers/threads.pdf
I work on multithreaded software and I get 31,516,776 synchronizations per second with a lock free algorithm and 12 threads and 31,565,052 on the lock benchmark.
When the threads are increased to 100 (contention) the lock benchmark does 3,419,271 requests per second whereas the lock free algorithm does 19,926,428 so the contention hurts them both but the lock free benchmark scales far better.
Threads aren't bad. The domain is not easy.
Re: Ruby 3.2.0 is from another dimension
#320Earlier quoted context omitted.
The Wikipedia article is wrong. A proc is a function. The misunderstanding here is confusing methods with functions. "def foo" defines a method, not a function. That same article claims that Java has first class functions on the basis of anonymous inner classes, that C# has them because of lambda expressions, etc. OCaml has different syntax for functions and methods. Does that mean it doesn't have first-class functio…
Ruby doesn't have first-class methods, either. Python has both first-class methods and first-class functions. > In computer science, a programming language is said to have first-class functions if it treats functions as first-class citizens. This means the language supports passing functions as arguments to other functions, returning them as the values from other functions, and assigning them to variables or storing…
"[P]eople like you insist on talking about things you don't actually know about" is insulting language. Consider discussing this with some people you know in real life to see what they think.