Beta testing Stad.social

@vidarh@stad.social

  • 14 Posts
  • 27 Comments
Joined 1 year ago
cake
Cake day: October 1st, 2023

help-circle







  • In the case of your example we’d do .map(&:unwrap) in Ruby (if unwrap was a method we’d actually want to call)

    Notably, these are not the cases _1 and _2 etc are for. They are there for the cases that are not structurally “call this method on the single argument to the block” e.g. .map{ _1 + _2 } or .map { x.foo(_1) }

    (_1 is reasonable, because iterating over an enumerable sequence makes it obvious what it is; _1 and _2 combined is often reasonable, because e.g. if we iterate over a key, value enumerable, such as what you get from enumerating a Hash, it’s obvious what you get; if you find yourself using _3 or above, you’re turning to the dark side and should rethink your entire life)





  • My own. My Emacs config grew over years to several thousand lines, and it got to a point where I decided I could write an editor in fewer lines that it took to configure Emacs how I liked it. It’s … not for everyone. I’m happy with it, because it does exactly only the things I want it to, and nothing else, but it does also mean getting used to quirks you can’t be bothered to fix, and not getting to blame someone else when you run into a bug.

    That said, writing your own editor is easier than people think, as long as you leverage libraries for whichever things you don’t have a pressing need to customize (e.g. mine is written in Ruby, and I use Rouge for syntax highlighting, and I believe Rouge is more lines of code than the editor itself thanks to all the lexers)






  • My first “paid” programming project (I was paid in a used 20MB harddrive, which was equivalent to quite a bit of money for me at the time):

    Automate a horse-race betting “system” that it was blatantly obvious to me even at the time, at 14 or so, was total bullshit and would just lose him money. I told the guy who hired me as much. He still wanted it, and I figured since I’d warned him it was utter bunk it was his problem.




  • V H@lemmy.stad.socialOPtocats@lemmy.worldReggie and the Fox
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    1 year ago

    The foxes here are so well fed and chill most of the time that the cats have lost almost respect for them… They’re still a bit cautious (which is good, because there certainly are incidents of foxes killing cats) but overall it’s pretty peaceful.

    Especially when it’s hot and nobody wants to run around.









  • Not trying to convince you - people have different preferences, but Ruby does exactly what you say and nothing else unless you start pulling in gems that do lots of monkey patching or metaprogramming cleverness.

    This is one of the reasons I dislike Rails in particular - it twists people’s idea of what clean Ruby can be like and introduces a lot of “magic” conventions that makes the code hard to read for someone who doesn’t know Rails.

    A lot of Ruby programmers do overdose on the “clever”, often inspired by Rails. You can do some truly insane things with metaprogramming in Ruby, but a lot of the time the cleverness is unnecessary and a bit of a footgun that people grab too early instead of thinking the problem through and realising there are simpler solutions.


  • My terminal is written in Ruby, and it uses a font-renderer that’s 100% Ruby ( https://github.com/vidarh/skrift - I didn’t write it from scratch, it’s a port from C ), and it’s definitely possible to get things “fast enough” for a surprising portion of code in Ruby these days, but you may end up writing Ruby code that is “surprising”. For faster Ruby, see e.g. Aaron Patterson’s walkthrough of speeding up a lexer which ends up doing things most Ruby devs would not usually do because at least some of the things he ends up doing goes against the readability (e.g. the TrueType renderer I linked above definitely sacrifices speed and assumes you’ll memoize heavily to maintain readability). For an interpreter, you’re probably right to drop to something lower level.


  • V H@lemmy.stad.socialtocats@lemmy.worldLove meeeeee
    link
    fedilink
    arrow-up
    11
    arrow-down
    1
    ·
    1 year ago

    I prefer to hope the person who made this is just a crappy writer who desperately tried to find a way to make us think they were talking to a girl first and couldn’t think of another way of describing rejection. (I fear that’s not the reason, and that you’re right, but I live in hope)