Live data from Hacker News

Ruby methods are colorless

jpcamara.com

11–20 of 242 posts

Re: Ruby methods are colorless

#12

Earlier quoted context omitted.

"Colorless" is probably referring to the thing in Rust where functions are "Colored" for async or sync execution I can tell you as a non-Ruby, non-web dev what the Ruby mindshare feels like to me: - I hear that Ruby is slow - The syntax looks odd - I know Ruby on Rails was very popular at some point but I think it's been displaced almost entirely by C# and Node.js - I have no intention of learning Ruby. If I was goin…

Here's three different ways to write a small shell script that turns letters into uppercase: Node: let inputData = ''; process.stdin.on('data', chunk => inputData += chunk ); process.stdin.on('end', () => console.log(inputData.toUpperCase()) ); Python: import sys sys.stdout.write( sys.stdin.read().upper() ) Ruby: puts $stdin.read.upcase

console.log(require('fs').readFileSync(0).toString().toLowerCase())

Re: Ruby methods are colorless

#13
post #8

Earlier quoted context omitted.

"Colorless" is probably referring to the thing in Rust where functions are "Colored" for async or sync execution I can tell you as a non-Ruby, non-web dev what the Ruby mindshare feels like to me: - I hear that Ruby is slow - The syntax looks odd - I know Ruby on Rails was very popular at some point but I think it's been displaced almost entirely by C# and Node.js - I have no intention of learning Ruby. If I was goin…

It's not a Rust thing. It's any language with a async/await. IIRC the original article was about JavaScript.

The underlying concept is applicable to lots of things, really. For example, the functions that are unsafe and safe to call from a POSIX signal handler can be treated as a function colouring problem.

Re: Ruby methods are colorless

#14
post #7
post #2

[flagged]

Is this an LLM account? Every comment starts with "It's fascinating"/intruinging/mind-blowing. Then some confused nonsense, and it always ends with a "Does anyone else?". This seems like a template where an AI filled in the blanks.

The original comment

> The idea that 'Ruby Methods Are Colorless' is intriguing. It seems to suggest that methods in Ruby lack inherent complexity, which aligns with the language's philosophy of simplicity and readability. Ruby's method names are often so intuitive that they don't obscure the functionality behind a facade of complexity, making the code feel 'colorless' in a good way—clear and transparent. Anyone else feel like this makes Ruby especially appealing for both beginners and seasoned developers?

Apart from the telltale signs of an LLM, it's so unlikely someone would write a long and grammatically correct comment that was completely unrelated to what the article was about.

Re: Ruby methods are colorless

#15
I've implemented coroutines in C and C++; my preferred multitasking environment is message-passing between processes. I'm not quite sure what the async/await stuff is buying us (I'm thinking C++, here). Like, I get multi-shot stackless coroutines, i.e., function objects, but I don't get why you'd want to orchestrate some sort of temporal Turing pit of async functions bleeding across your code base.

I dunno. Maybe I'm old now?

Anyways; good for Ruby! Async/await just seems very faddish to me: it didn't solve any of the hard multithreading/multiprocessing problems, and introduced a bunch of other issues. My guess is that it was interesting type theory that bled over into Real Life.

Re: Ruby methods are colorless

#16
post #15

I've implemented coroutines in C and C++; my preferred multitasking environment is message-passing between processes. I'm not quite sure what the async/await stuff is buying us (I'm thinking C++, here). Like, I get multi-shot stackless coroutines, i.e., function objects, but I don't get why you'd want to orchestrate some sort of temporal Turing pit of async functions bleeding across your code base. I dunno. Maybe I'm…

If you have hundreds or thousands of connection-handlers or scripts-attached-to-game-objects, then it can be useful to write code in those without dividing the code into basic blocks each time I/O might be performed or time might pass in the game.

I generally agree that manually migrating everything to "be async" in order to achieve this exposes at the very least a lack of belief that computers can be used to automate drudge work.

Re: Ruby methods are colorless

#17
post #15

I've implemented coroutines in C and C++; my preferred multitasking environment is message-passing between processes. I'm not quite sure what the async/await stuff is buying us (I'm thinking C++, here). Like, I get multi-shot stackless coroutines, i.e., function objects, but I don't get why you'd want to orchestrate some sort of temporal Turing pit of async functions bleeding across your code base. I dunno. Maybe I'm…

I really like the patterns that it enables for situations with a lot of parallel IO. Easy example is any kind of scraper, where you're fetching large numbers of pages and then immediately processing those to generate more requests for the links and assets referenced within.

Re: Ruby methods are colorless

#18
I don't like colored function for obvious reasons, but fully colorless for async means you don't know when things are async or not.

There are a lot of things I dislike in JS, but I think the I/O async model is just right from an ergonomics point of view. The event loop is implicit, any async function returns a promise, you can deal with promises from inside sync code without much trouble.

It's just the right balance.

Re: Ruby methods are colorless

#19
post #15

I've implemented coroutines in C and C++; my preferred multitasking environment is message-passing between processes. I'm not quite sure what the async/await stuff is buying us (I'm thinking C++, here). Like, I get multi-shot stackless coroutines, i.e., function objects, but I don't get why you'd want to orchestrate some sort of temporal Turing pit of async functions bleeding across your code base. I dunno. Maybe I'm…

My theory is that JavaScript programmers who were forced into thinking this way for decades with their single-threaded runtime have infected other languages with the idea that this style of coding is not only good but furthermore that it needs to be explicit.

Thank goodness we have wiser language developers out there who have resisted this impulse.

Re: Ruby methods are colorless

#20

I don't like colored function for obvious reasons, but fully colorless for async means you don't know when things are async or not. There are a lot of things I dislike in JS, but I think the I/O async model is just right from an ergonomics point of view. The event loop is implicit, any async function returns a promise, you can deal with promises from inside sync code without much trouble. It's just the right balance.

> fully colorless for async means you don't know when things are async or not

The IDE can tell you.

Post reply on HN