• 0 Posts
  • 14 Comments
Joined 11 个月前
cake
Cake day: 2023年8月2日

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).


  • 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”.


  • 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).


  • Yeah choosing to abstain from eating certain animals for moral reasons (dogs/cats/cows/horses) and not others (pigs/chickens/fish) is definitely weird. Though the majority of people in western society fall into this category, you just moved one more animal across the boundary due to normalization. If you were brought up with pigs, chickens, and fish you’d probably abstain from those too.

    The real question to ask though is despite normalization, what’s actually the right thing to do? Is it actually okay that some people eat dogs, cats, and cows? Or is it wrong to do this?

    People should put more effort into reconciling this dissonance, because slaughter and oppression is not a matter we should leave up to the normalization of society to decide. Society has countless times normalized immoral things.


  • I didn’t compare capitalism to slavery. I said the word slavery. The first paragraph wasn’t demonstrating a comparison, it was demonstrating a principle (principles are universalized, comparisons aren’t). The idea that every system has positives, but those systems can still be horrifically bad.

    I don’t know if it’s emotion that’s clouding your reading comprehension, I hope it is, because then you can calm down and have a reasonable conversation. If it’s not, then this conversation isn’t worth having because you won’t understand half of what I’m saying. Literally 50% of your last message was you misrepresenting what I was saying.

    A capitalist society cannot enact socialist policies. It can enact “social” policies. These policies are inspired by socialism, and often advocated for by socialists, but the policies themselves are not socialist policies. Capitalism is an economic system where the means of production are privately owned, and socialism is an economic system where the means of production are socially owned. If private (not personal) property exists, it’s not socialism. It’s not necessarily capitalism (you could have other systems with private property), but in our world it always is.

    Welfare capitalism, where these social policies exist, is a well established ideology that has been around for about 80 years in any serious form, and yeah welfare can be used to address some of the negative tendencies of capitalism, but it doesn’t fix them. It’s applying a band-aid fix, not addressing the problem. In the real world what this means is there’s a class of people always working to remove those regulations and welfare because their class interests are opposed to ours.

    Class distinctions cannot be solved with a regulation, they have to be solved with a societal restructuring. Our legal system does not support the idea of abolishing private property and by extension classes.


  • If by “have merit” you mean “has some positive aspects”, sure. Every system has merit. Slavery had merit (slave owners got cheap cotton). The Holocaust had merit (antisemites felt better). The issue is weighing the merit against the negatives. You can’t just say two systems have positive aspects and call it a day.

    Are you a fan of democracy or authoritarianism? Capitalism is a system where productive forces are driven undemocratically, in the name of profit instead of by worker democracy. The commodification of everything exists in a world of private property:

    • our bodies (labor power)
    • our thoughts (intellectual property)
    • the specific ordering of bits on a hard drive you own (digital media, DRM)
    • the means of production (which exist as a result of collective knowledge, infrastructure, and labor)

    These things being commodified and privatized are ridiculous in any democratic, non-capitalist system.

    However, these ridiculous conditions are absolutely necessary in a capitalist society. Without them the system falls apart. And as society continues to progress, the situation gets more and more ridiculous.

    What about when AI “takes away” jobs for 50% of Americans (as in capitalists fire humans in favor of AI)? That’ll collapse our society. Less work would be a good thing in any reasonable system, but not in capitalism. Less work is an existential threat to our society.

    If we ever have an AI that is as capable as humans are intellectually, the only work left for us will be manual labor. If that happens, and robots get to the point of matching our physical abilities, we won’t be employable anymore. The two classes will no longer be owners and workers, they’ll be owners and non-owners. At that point we better have dismantled capitalism, because if we don’t then we’ll just be starving in the street, along with the millions who die every year from starvation under the boot of global capitalism.