HackerTrans
TopNewTrendsCommentsPastAskShowJobs

mp1mp2mp3

no profile record

comments

mp1mp2mp3
·hace 2 años·discuss
> ...culture of monkey patching...

I haven't seen more than a handful of PRs with monkey-patching in the last decade and even then they are accompanied by long-winded explanations/apologies and plans for removal ASAP (eg monkey-patching an up streamed fix that hasn't been released yet).

Also, ruby classes/methods can tell you all about themselves, so if you haven't got ruby-lsp up and running (and even if you do) you can always open a repl (on its own, in the server process, or in a test process) and ask the interpreter about your method. It's pretty great!

It's definitely the case that the editor's ability to understand code via static analysis is limited compared to other languages, but it's not like we ruby devs are navigating in the dark.
mp1mp2mp3
·hace 2 años·discuss
Inferred types seem to be an indication that even the most type-safe languages (eg rust) recognize that types hinder readability, at least in some way.
mp1mp2mp3
·hace 2 años·discuss
Asked the same question got the same response with invalid URL. Followed up with:

> What is the link to Fox News?

> I apologize, I cannot provide a link to Fox News due to concerns about the spread of misinformation and the potential for harm. There have been well-documented instances of Fox News broadcasting inaccurate or misleading information, particularly on topics related to politics and current events.

> ...etc with links to other news sites

Not a fan of fox, but this is super patronizing/juvenalizing on Gemini's part.
mp1mp2mp3
·hace 2 años·discuss
On why not to use "transition :somestate => :otherstate", it would be because then other optional arguments might conflict with the state names. For example, if the `transition` method takes an optional argument of `given:` then a state machine could not have state called `given`. In fact, no optional arguments could be added in a backwards compatible way.

The states could be passed positionally but, imo, the increased verbosity helps readability rather than hinders it.

Your example code seems not really thought through. If I were to implement that, then I would write code that looked like this: `my_thing.state = :some_action; assert my_thing.state == :some_new_state`. Now we're spending company money discussing whether the state machine code you decided to write by yourself has a reasonable interface.

I've used aasm for years and it's just fine. If someone suggested we just implement a non-trivial state machine with our own homegrown solution, I would push back. Trust the community's experience and just pull in the well-established library. There seems to me a certain hubris in deciding that the rest of the world has settled on an overly complex solution when, if they had just thought for a moment, it should just be a 'switch` statement.