• 0 Posts
  • 14 Comments
Joined 1 year ago
cake
Cake day: August 2nd, 2023

help-circle
  • Yup this is the real world take IME. Code should be self documenting, really the only exception ever is “why” because code explains how, as you said.

    Now there are sometimes less-than-ideal environments. Like at my last job we were doing Scala development, and that language is expressive enough to allow you to truly have self-documenting code. Python cannot match this, and so you need comments at times (in earlier versions of Python type annotations were specially formatted literal comments, now they’re glorified comments because they look like real annotations but actually do nothing).


  • Glad someone said this, it bothers me even with human ages. Like there’s this perception that as you get older you simply gain knowledge, wisdom, world experience, etc. Not a lot of people account for biological limits for knowledge/memory, nor degradation from aging.

    If some young intern decided to try to have sex with Biden, I think there’s genuinely a conversation to be had about if that’s statutory rape. I think you’d need a healthcare professional to rule on if Biden has the mental capacity to fully consent. Similar to a drunk person. They’re still obviously a person able to think/engage with the world, but they’re heavily impaired and unable to fully consent as a result. Age impairs cognition too.



  • In humans there’s a psychological phenomenon called “crowding out”, essentially it’s hard for our brains to attach multiple, powerful incentives to one activity. Generally the “lesser” ones get crowded out by the more important one.

    I’m still young (26), and still feel the same way about programming, I deeply enjoy it. However, I know programmers who were passionate like me when they were younger, and that passion has been slowly drained as they continue to code professionally, and I’ve seen it come back when they move into non-programming roles (be it industry change or moving to management).

    Generally you won’t find yourself wanting to program 40 hours a week, 48-50 weeks a year, for 50 years without a substantial break, and yet that’s what capitalism expects of workers. Yet you’ll continue to work because there’s a more important incentive than passion, money.

    You need money to survive (food, shelter, etc.) and your brain understands those are more important than fulfilling a passion, that’s why you’ll go to work even if you’re drained mentally. You’ll continue to do that forever so long as you don’t have the financial freedom to do otherwise (which is the goal of capitalists, this is why we have COL-based incomes, so as not to overpay people who live in cheaper areas as it’d allow them the freedom to leave).


  • Yes, but not because the goal of having exceptions in types is bad, rather Java’s type system isn’t advanced enough to support the ideal solution here.

    Scala 3 is working on experimental capture checking capabilities, which allows functions to express certain capabilities (file access, networking, db, etc.), and CanThrow capabilities (e.g exceptions at the type level) are one reification of this.

    The CanThrow docs I linked have a good introduction into why Java checked exceptions are bad, and how Scala’s alternative is far better. Essentially it comes down to a lack of polymorphism in checked exceptions. In practice this means they’re incredibly verbose outside of simple usecases, and with a very easy escape hatch (RuntimeException), you don’t even get the guarantee of knowing a function without checked exceptions doesn’t throw.

    Python will also have this latter issue. Python’s “typing” in general has this issue actually. Types aren’t validated unless you use an external tool, and even then Any is a leaky abstraction that can hide any level of typing errors, unlike in properly typed languages where it’s not leaky. You need it to be leaky in gradually typed environments, or you wouldn’t be able to use a ton of the Python ecosystem, but this vastly reduces the effectiveness of the typing solution.

    I don’t know if Python’s solution here will address the lack of polymorphism that Java’s solution has, I’ll have to look into it more.


  • Activists don’t need to be one-track minded. They rarely are. I’m a vegan, socialist, anti-fascist who is against the ethnic cleansing of Palestinians and for climate justice globally. There’s very strong overlap in these positions. There’s a reason you won’t find a lot of Republican vegans, or pro-Israel socialists.

    Yes, sometimes people don’t put in the time to investigate these issues, and I commend you for knowing the limits of your own knowledge, I’ve recommended to people before that it’s better to just say “I don’t know enough about this issue” instead of arriving at an under-researched position. However, it’s not necessary to criticize people who are actually activists, learn about these issues, and go out into the world and advocate for change, so long as they’re advocating for the right thing.

    The topic being brought up might ostracize people, but it will also put the topic into people’s minds. People like you might not know what the correct position is here, but you hear the constant pro-Israel propaganda pumped out by the U.S and might arrive at a subconscious conclusion that aligns with the imperial core.

    If you hear people speaking out against the apartheid state of Israel, especially people who align with your values, you might be inclined to look into it more, or at the very least not automatically accept U.S propaganda on the issue.





  • I hate the phrasing “terrorist group” here. Not because what happened here wasn’t an atrocity, but because people generally refuse to call state-backed violence “terrorist” violence. The word terrorism is incredibly broad, easily describing a ton of things Israel does. Yet, we refuse to call them a terrorist organization.

    Israel slaughtered hundreds of protesters 4 years ago in Gaza.

    Israel and Egypt have been blockading the Gaza strip in violation of the GCIV since 2007.

    In 2014, a triple-homicide was committed. Israel claimed it was Hamas, and arrested hundreds of Palestinians. Hamas sent rockets into Israel, killing 2 people, and Israel initiated Operation Protective Edge, killing thousands of Palestinians.

    Not to mention the entire Israel-Palestine conflict can be traced back about 100 years, where imperialist Britain endorsed the idea of a Jewish homeland in Palestine in the Balfour Declaration. Eventually leading to the formation of Israel in the late 40s and the subsequent ethnic cleansing of Palestinians, forcing nearly a million natives to move to make way for Israel.

    “terrorism” is politically charged language with the intent of making us sympathize with a certain side. Of course we’ll side with the “Israel state” and against the “Hamas terrorist group”. The language used to describe these groups already prescribes how we should view them. Western media will never describe Israel’s atrocities as terrorist actions, so people will dismiss the slaughter of tens or even hundreds of thousands of innocent Palestinians as “just war”.


  • What’s actually being punished? Would she have been sentenced to 8.5 years in prison if she pushed an 87 year old who was slightly less frail and instead of dying sustained major injuries? Would she have been sentenced if she pushed an extraordinarily healthy 87 year old who knew how to gracefully fall and sustained no serious injuries?

    It seems that the act of pushing alone isn’t enough to sentence a person to nearly a decade in prison. There was likely no intention to kill, though that was the outcome. What if she sneezed on the 87 year old, and in a fit of panic the 87 year old fell over and died? Again, no intention to kill, though that would still be the outcome.

    I think it’s clear this should be punished more intensely than sneezing, pushing an old person would very commonly result in serious injury, so this is definitely assault.


  • Most people aren’t practicing teachers, so it makes sense that not all explanations are the best. Trying to get an intuitional understanding of passing by reference or passing by value in imperative languages is arguably more important than understanding how map works, and yet I’d argue it’s also harder to do.

    If you understand map (not just lists, but futures, IOs, Options, Maybes, etc.) then you understand Functors. Yes there are laws, but mathematical laws here are just encoding our intuition. Something like Iterator in Java may not have laws, but you would expect that calling .next() doesn’t modify an SQL database, though it wouldn’t be a technically invalid implementation if it did. The same is not true for Functors. If you map over a List and the act of mapping each int to its double modified a database then you wouldn’t have a lawful functor. But that should make sense intuitionally without knowing the laws.

    People in OO land are more happy to say they “understand” something if they generally get what the abstraction is going for. Do you know all the methods for Iterator/Iterable in Java? Even if you didn’t, you’d likely say you get the “point” of an Iterable. The bar for understanding things in the FP community is usually higher than just understanding the point of something.

    This doesn’t mean FP is more complicated. Actually it kind of means it’s simpler, because it’s not unreasonable for people to totally understand what Functors are for all languages that implement them. The same is not true of Iterable/Iterator. There’s no way you’d have more than just an intuition about what Iterable is in a language you don’t know. I don’t program in Agda or Idris, but I know Functor in those languages are the same as Functor in Scala and Haskell. Same with Monad, Monoids, etc.



  • I think the dislike for Functors/Monads/Monoids etc. is super overrated. I’m not a mathematician, but christ these are beautiful abstractions coming from a background in Java and OO programming.

    Functor instances are defined by one function. Once you learn the one main thing that Functors do (mapping), you’ll understand them no matter the language. Monoids have 2, Monads have 2, etc. Yes all there are functions built in terms of the functions required in the typeclass definitions (or several typeclasses), but they don’t need to be known to effectively use the abstractions.

    I was able to easily transfer most of my Haskell knowledge to Scala at my last job in the typelevel ecosystem because of HKTs like Functors, Monads, monad comprehensions, Monoids, etc. I was the go-to guy for FP-related questions despite most of my background being in Haskell and not Scala.

    Using an Iterable in Java will be different than an Iterable in any other language in at least some respects. Yes they will represent the same abstract idea, but you can’t just 1:1 transfer knowledge between different Iterable implementations.

    I’ve programmed professionally in Java, Kotlin, Scala, Ruby, Python, JS/TS, and many more in hobbyist settings, and the cleanest transition was Haskell -> Scala (omitting language transitions on the same runtime, so Java -> Kotlin or JS -> TS).