expr

joined 1 year ago
[–] expr@programming.dev 6 points 8 hours ago

This is completely different from electron. Nix dependencies will be shared if they share the same hash. Electron just blindly copies everything over every time.

[–] expr@programming.dev 7 points 23 hours ago

All milk has lactose, which is sugar.

[–] expr@programming.dev 10 points 3 days ago (1 children)

It's not replacing anyone. It's just an excuse for the usual capitalistic bullshit that they would be doing anyway.

[–] expr@programming.dev 1 points 4 days ago

It's just some kind of starch. It often is noodles, but potatoes or rice are also common.

[–] expr@programming.dev 35 points 4 days ago

Spoken like a true addict.

Tiktok is genuinely terrible, as is Facebook and Instagram (though TikTok is somewhat worse).

You're on Lemmy. People here don't like Facebook or Instagram either.

[–] expr@programming.dev 2 points 4 days ago (3 children)

Pretty sure everywhere except Minnesota calls it a casserole.

[–] expr@programming.dev 1 points 5 days ago

Yeah, it's a little insane to me to automatically run code that exists in a file in the current directory, by default.

Like there's a reason that direnv requires you to execute direnv allow if you enter a directory with an .envrc that you hadn't previously approved.

I don't know of any other editor that has this as standard behavior, and for good reason.

[–] expr@programming.dev 2 points 1 week ago (1 children)

A language is not functional just because it supports higher order functions. Technically C even supports them (even though the ergonomics and safety of them are terrible). Would you call C a functional programming language? Obviously not. Rust is also not a functional language, even though it comes closer than most OO/imperative languages.

Kotlin and plenty of other OO languages have borrowed some ideas from functional languages in recent years because those ideas are useful. That doesn't make them functional languages. If Kotlin were a functional language, then it wouldn't need libraries like arrow to try to make doing FP in Kotlin even (kind of) possible.

Hallmarks of FP (beyond higher-order functions), in no particular order:

  • Organization around functions as the fundamental unit of code
  • Code primarily defined in terms of expressions and data transformations rather than statements manipulating object state (so languages that have big blocks of imperative statements like Kotlin don't count)
  • A general orientation around pure functions, even if they vary on the degree to which they enforce purity
  • Explicit parameter passing being the standard and preferred way of providing data to functions, rather than methods operating on implicit state
  • First class support for function composition (method chaining doesn't count)
  • Pattern matching and destructuring as a first-class and ubiquitous concept (what Kotlin does have is a joke comparatively and no one would actually call it that)
  • For statically-typed functional languages, first class support for algebraic data types (Kotlin has sealed classes which can kind of be used to try to emulate it, but it's pretty awkward in comparison and requires you to write very OO-ish code to use)

There are some minor exceptions, such as Clojure lacking pattern matching, but on the whole functional languages generally fit these descriptions.

[–] expr@programming.dev 2 points 1 week ago

It's funny you mention Reddit because there was a subreddit dedicated to making fun of shit "centrist" takes like yours: https://www.reddit.com/r/ENLIGHTENEDCENTRISM/.

The fact is that politics in the US is skewed so far to the right that the options are center-right (Democrats) or far, extremist right (Republicans).

[–] expr@programming.dev 3 points 1 week ago (3 children)

That list also counts Java and C# as "functional languages". I wouldn't take it too seriously. Ocaml, Scala, F#, etc. are impure functional languages. Kotlin absolutely is not. Having a couple of features you might find in functional languages does not make a language functional. Kotlin is still very much an OOP-based language. It's basically a somewhat nicer Java.

[–] expr@programming.dev 1 points 1 week ago (5 children)

Minor nit: Kotlin is decidedly not a functional language.

Design patterns in OOP exist purely to solve the problems created by OOP itself. If you have a language with proper ADTs and higher order functions, the need for traditional design patterns disappear since the problems they solve are first-class features baked into the language.

The first-class replacement for the Strategy pattern (and many other patterns such as the Visitor pattern) is sum types (called enums in Rust).

[–] expr@programming.dev 4 points 1 week ago

All it means is if you were to reverse the order of the characters, you'd get the same string you started with. So "dog" isn't a palindrome because when you reverse it, you get "god". "dog god" is a palindrome, though, because if you read it backwards, it's also "dog god".

view more: next ›