Just a small frog hopping from post to post. Because it may be Wednesday my Dudes!

Sometimes in German, sometimes in English.

  • 0 Posts
  • 163 Comments
Joined 2 years ago
cake
Cake day: June 14th, 2023

help-circle

  • I am not sure where your defensive reaction comes from, but please read something about toxic masculinity before being so vocal about your opinion. Toxic masculinity can be reinforced by all genders and all genders can be victims.

    And admitting your own errors is definitely not equally seen in different groups.


  • LeFrog@discuss.tchncs.detoLemmy Shitpost@lemmy.worldOk, boomer
    link
    fedilink
    arrow-up
    33
    arrow-down
    1
    ·
    12 days ago

    Two years later he admitted that maybe there was something about climate change nowadays…

    At least they changed their mind (a little bit). I think this is a huge part of the problem: admitting an error and being supported for that admission is something that is frowned upon in certain groups. I think toxic masculinity plays one big factor here. Admitting errors is seen as “not masculine”, especially within conservative groups.





  • This is basically one of the core ideas of Ruby: that you can read it like a story. Once you are used to reading it as “do X unless Y”, you will miss it in other languages. Note that I wrote Y, not Y is true. Because often Y is a statement that has meaning in itself.

    Example:

    # imagine that given_name is some text from user input
    
    # this is of course valid:
    user.name = given_name if !user.is_locked
    
    # but this reads more fluently:
    user.name = given_name unless user.is_locked
    

    Ruby also allows using ? as last character in method names, which is a convention for methods that return either true or false.

    Same goes for ! (the bang operator), that is commonly used to tell developers that there exists a non-bang version of the same method as well. The bang method is often the more strict version (e.g. raises an error instead of returning nil; or having side effects compared to the non-bang version).

    So the above example may be more commonly written like this:

    user.name = given_name unless user.locked?
    

    and the question mark makes you automatically adding is or has while reading: Set the user’s name to the given_name unless the user is locked

    Of course this is all by convention and you may also do it different. But that’s how most Ruby code is written.

    To stay consistent, lots of projects use RuboCop, which warns you on inconsistency based on your project’s settings.