• 0 Posts
  • 69 Comments
Joined 11 months ago
cake
Cake day: August 2nd, 2023

help-circle


  • Yeah, it doesn’t really belong in the ‘no’ column. It’s not an appropriate cat food because it’s not nutritionally complete.

    So it’s rather like how just eating bread or cornmeal that don’t have added vitamins will give you scurvy or pellagra. But obviously they’re not poisonous or anything and most of the world eats them without a problem.



  • And memory bugs are only a subset of bugs that can be exploited in a program. Pretending Rust means no more exploitation is stupid.

    This is facile.

    According to Microsoft, about 70% of security bugs they see are memory safety issues.

    Yes: if you introduce memory safety, there’s still those 30% of security bugs left. But, well, I’d rather worry about 30% of issues than 100%…

    Similarly, I use libraries that eliminate SQL injections unless you really go out of your way.





  • Ish.

    There’s precisely zero skill involved in e.g. roulette.

    Poker, fantasy football, and horse betting though, are influenced by skill. But they’re all clearly still gambling.

    The important thing in those 3 is that you’re not betting against the house. You’re betting against other players, and that you’re the smart enough to come out on top even after the house takes their cut. Unless you’re Nate Silver, though, chances are you’re not the smartest person in the room.



  • Symbols display with friendly string-y names in a number of languages. Clojure, for example, has a symbol type.

    And a number of languages display friendly strings for enumy things - Scala, Haskell, and Rust spring to mind.

    The problem with strings over enums with a nice debugging display is that the string type is too wide. Strings don’t tell you what values are valid, strings don’t catch typos at compile time, and they’re murder when refactoring.

    Clojure symbols are good at differentiation between symbolly things and strings, though they don’t catch typos.

    The other problem the article mentions is strings over a proper struct/adt/class hierarchy is that strings don’t really have any structure to them. Concatenating strings is brittle compared to building up an AST then rendering it at the end.

    Edit: autocorrect messed a few things up I didn’t catch.


  • Javascript is generally considered OOP, but classes weren’t widely available till 2017.

    Inheritance isn’t fundamental to OOP, and neither are interfaces. You can have a duck- typed OOP language without inheritance, although I don’t know of any off the top of my head.

    Honestly, the more fundamental thing about OOP is that it’s a programming style built around objects. Sometimes OO languages are class based, or duck typing based, etc. But you’ll always have your data carrying around it’s behavior at runtime.


  • If you’d like to look up more about the origins of PIE, look up the Kurgan Hypothesis, which suggests that Proto-Indoeuropean originated on the steppes.

    Basically everything we know about PIE, we know from looking at its descendants. If a word appears in multiple unrelated branches, it’s probably from the common ancestor. Particularly if there’s consistent sound changes on one or more branches.

    For example, it seems that a lot of PIE words with a p morphed into f in germanic languages. So, given the English father, Dutch Vader, Old Saxon fadar, Latin pater, Sanskrit pitar, Old Persian pita, etc. we can figure out that father goes back to some original PIE word which was probably something like pəter.

    Similarly, we see similar words for salmon both in Germanic and Slavic. And in the extinct Tocharian language, the word for fish in general was laks. Lox originating only 1500 years ago means that the Slavic and Tocharian would be a pretty strange coincidence.


  • keeping state (data) and behavior (functions) that operate on that state, together

    Importantly, that’s “together at runtime”, not in terms of code organization. One of the important things about an object is that it has dynamic dispatch. Your object is a pointer both to the data itself and to the implementation that works on that data.

    There’s a similar idea that’s a bit different that you see in Haskell, Scala, and Rust - what Haskell calls type classes. Rust gives it a veneer of OO syntax, but the semantics themselves are interestingly different.

    In particular, the key of type classes is keeping data and behavior separate. The language itself is responsible for automagically passing in the behavior.

    So in Scala, you could do something like

    def sum[A](values: List[A])(implicit numDict: Num[A]) = values.fold(numDict.+)(numDict.zero)
    

    Or

    def sum[A: Num](values: List[A]) = values.fold(_ + _)(zero)
    

    Given a Num typeclass that encapsulates numeric operations. There’s a few important differences:

    1. All of the items of that list have to be the same type of number - they’re all Ints or all Doubles or something

    2. It’s a list of primitive numbers and the implementation is kept separate - no need for boxing and unboxing.

    3. Even if that list is empty, you still have access to the implementation, so you can return a type-appropriate zero value

    4. Generic types can conditionally implement a typeclass. For example, you can make an Eq instance for List[A] if A has an Eq instance. So you can compare List[Int] for equality, but not List[Int => Int].




  • Yes, English didn’t exist 8000 years ago. Instead, there was a language called Proto-Indoeuropean spoken on the steppes of Ukraine. Just like how Latin spread and local dialects slowly became Spanish, French, Italian, Romanian, etc., PIE spread out and its descendants became Greek, Sanskrit, Russian, Latin, German, etc.

    Part of what happened over time was sound shifts. For example, PIE p morphed into an f in Proto-Germanic. Father and the Latin word pater go back to the same PIE root word, but father exhibits the sound change of p -> f you saw in Germanic languages.

    Similarly, Spanish has a sound change where f changed into h. So the Latin word fabulari (to chat) became hablar in Spanish and falar in Portuguese.

    The point of the article is that the PIE word for salmon, laks, by random chance didn’t really morph much in Germanic languages. So you have lax, lox, lachs, etc.

    Interestingly, the Old English word for salmon was leax, and that made its way into Middle English and early Modern English as lax. It died out in favor of the French-derived salmon, and then we borrowed lox back from Yiddish.

    It’s like if beef entirely replaced cow, then we borrowed back koe or kuh from Dutch or German.




  • Which is why it’s one of the hardest languages to learn, there wasn’t even a noble population who were helping rules be set logically, it’s a slang language.

    Which languages had nobles changing the rules of the language to be logical, and beat the peasantry until they repeated their absurd shibboleths?

    Proscriptivists have existed in many languages, English included. They’ve basically always been tilting at windmills.

    Governments tend to be most effective at killing languages wholesale, rather than systemically changing grammar. And it’s something that’s been far more effective in the past couple hundred years as part of nation- building projects. E.g. the efforts of France, Italy and Spain to squash minority languages like Occitan, Galician or Neapolitan.