Nevoic

joined 1 year ago
[–] [email protected] 3 points 1 year ago (1 children)

Every year or two I give Windows a genuine try for around a month. WSL2 is actually pretty decent, it's a massive improvement on the Windows development experience I had back in 2015 when I tried running Windows full time doing Python/Ruby/Java development. Required cygwin, git bash, power shell, and cmd depending on what I was doing. It was a special kind of nightmare. Lots of native gems couldn't compile, lots of tooling issues, etc.

Now you can use exclusively Windows terminal, keep essentially all your development stuff in a Linux subsystem, and pretend you're in Linux. Integration with things like vscode or intellij is quite decent with the WSL.

That said, I hate Microsoft, hate the lack of customization, hate the default UI, hate the split between Windows 95-style settings and new Windows 10+, it's inconsistent as hell. Moving windows across monitors with different scaling still resizes the windows in a very archaic way. You can't reasonably use multiple desktops because you can't easily rebind keys to swap desktops without third party software. I've changed DEs in Linux for smaller issues than these.

[–] [email protected] 14 points 1 year ago (4 children)

Yeah for both Ubuntu and Arch on two separate computers in my house, the process was just install the distro then install steam + Lutris (steam for steam games, Lutris for every other kind of game like League or WoW).

Installing steam games is identical in Linux and Windows for the vast majority of games. Installing non-steam games is arguably easier since you never have to go to a web browser.

Honestly the only reason Windows is "easier" is because it's preinstalled on computers. As someone who has fresh installed Linux and Windows, Linux is miles easier to install. To install Windows 11 I tried following their recommendations (enabling TPM and secure boot in bios), but the W11 installer still didn't like my 2 year old computer, so had to open up the command prompt, regedit, and add 3 Bypass registry DWord 32 bit values. Then actually installing the O.S you just sit there and wait with an unusable computer. Linux installations have nice GUIs that are far more modern, don't require weird terminal hacks, and you have a usable computer while it's installing (you can open up Firefox and browse the web for example).

\rant

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago)

As a vegan this is the best non-vegan take I've ever seen, thanks. I'll have to find a pig to staple my phone to.

[–] [email protected] 11 points 1 year ago

It's also mad that this is also the case for adults. When you turn 18, you shouldn't suddenly lose basic rights (like access to food and shelter), but that's exactly what most capitalists want to happen (and so that's how it works).

Goods with inelastic demand shouldn't be driven by the profit motive. Food, healthcare, housing, etc. We can let luxury goods stay within the private sector for now since people don't need them to survive, and come back to that conversation at a later date.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago) (1 children)

Note: Lemmy code blocks don't play nice with some symbols, specifically < and & in the following code examples

This isn't a language level issue really though, Haskell can be equally ergonomic.

The weird thing about ?. is that it's actually overloaded, it can mean:

  • call a function on A? that returns B?
  • call a function on A? that returns B

you'd end up with B? in either case

Say you have these functions

toInt :: String -> Maybe Int

double :: Int -> Int

isValid :: Int -> Maybe Int

and you want to construct the following using these 3 functions

fn :: Maybe String -> Maybe Int

in a Rust-type syntax, you'd call

str?.toInt()?.double()?.isValid()

in Haskell you'd have two different operators here

str >>= toInt &lt;&amp;> double >>= isValid

however you can define this type class

class Chainable f a b fb where
    (?.) :: f a -> (a -> fb) -> f b

instance Functor f => Chainable f a b b where
    (?.) = (&lt;&amp;>)

instance Monad m => Chainable m a b (m b) where
    (?.) = (>>=)

and then get roughly the same syntax as rust without introducing a new language feature

str ?. toInt ?. double ?. isValid

though this is more general than just Maybes (it works with any functor/monad), and maybe you wouldn't want it to be. In that case you'd do this

class Chainable a b fb where
    (?.) :: Maybe a -> (a -> fb) -> Maybe b

instance Chainable a b b where
    (?.) = (&lt;&amp;>)

instance Chainable a b (Maybe b) where
    (?.) = (>>=)

restricting it to only maybes could also theoretically help type inference.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Here's an example (first in Haskell then in Go), lets say you have some types/functions:

  • type Possible a = Either String a
  • data User = User { name :: String, age :: Int }
  • validateName :: String -> Possible String
  • validateAge :: Int -> Possible Int

then you can make

mkValidUser :: String -> Int -> Possible User
mkValidUser name age = do
  validatedName ← validateName name
  validatedAge  ← validateAge age
  pure $ User validatedName validatedAge

for some reason <- in lemmy shows up as &lt;- inside code blocks, so I used the left arrow unicode in the above instead

in Go you'd have these

  • (no Possible type alias, Go can't do generic type aliases yet, there's an open issue for it)
  • type User struct { Name string; Age int }
  • func validateName(name string) (string, error)
  • func validateAge(age int) (int, error)

and with them you'd make:

func mkValidUser(name string, age int) (*User, error) {
  validatedName, err = validateName(name)
  if err != nil {
    return nil, err
  }

  validatedAge, err = validateAge(age)
  if err != nil {
    return nil, err
  }

  return User(Name: validatedName, Age: validatedAge), nil
}

In the Haskell, the fact that Either is a monad is saving you from a lot of boilerplate. You don't have to explicitly handle the Left/error case, if any of the Eithers end up being a Left value then it'll correctly "short-circuit" and the function will evaluate to that Left value.

Without using the fact that it's a functor/monad (e.g you have no access to fmap/>>=/do syntax), you'd end up with code that has a similar amount of boilerplate to the Go code (notice we have to handle each Left case now):

mkValidUser :: String -> Int -> Possible User
mkValidUser name age =
  case (validatedName name, validateAge age) of
    (Left nameErr, _) => Left nameErr
    (_, Left ageErr)  => Left ageErr
    (Right validatedName, Right validatedAge) => 
      Right $ User validatedName validatedAge
[–] [email protected] 3 points 1 year ago (1 children)

For people unfamiliar with the vim ecosystem (I assume that's at least part of the down votes), it's actually much closer than you'd expect. If you're only familiar with vi/vim, nvim customizations are essentially on feature parity with vscode, with the added benefit of the vim-first bindings.

What you have to do is install a customized neovim environment. Lunarvim, astrovim, nvchad, etc. Most of them have single line installation options for Linux, and then it comes with a bunch of plugins that will pretty much match whatever you'd find with vscode extensions.

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Agree on majority of the post, except for "make the choices you feel are right". Hard disagree on this normatively. If you're saying it descriptively, sure, but it's essentially tautological at that point.

We shouldn't advocate that people just act in whatever way feels correct to them. Sociopaths feel like it's okay to do things that are not okay. So do bigots, racists, speciesists, sexists, etc.

We should instead do what you're doing with the majority of your post, advocate for correct positions and then come to a rational conclusion with the people we are talking to. Giving them a get out of jail free card, permitting them to do literally anything, is unnecessary.

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

Saying the word "Nazi" or "slave" or whatever doesn't automatically make someone incorrect. Even if this were another Godwin's law that doesn't make the comparison invalid.

[–] [email protected] 1 points 1 year ago (2 children)

There's a subset of people that anytime a comparison is made, where one situation is worse than the other, something happens where they become unable to understand the concept of a principle.

It's like you recognize "hey, chattel slavery is worse than wage slavery!" (which is correct), and therefore there can be no principle applicable to both situations (incorrect).

I assume it's that you're offended by the comparison, and the emotion gets the better of you, disallowing you from thinking clearly about it. I don't know what else it would be.

[–] [email protected] 1 points 1 year ago (4 children)

Yeah I do, just on the principle that an environment that retaliates against worker solidarity is an oppressive environment.

It's similar to someone saying "can slaves be well taken care of by their owners?" Many people would say yes, but I would say no on principle. No matter how short the work day, no matter the benefits, months off every year, etc. I would say on principle that being owned means you're not well taken care of.

The principle here being that sometimes "one" negative can be enough to mean you're not "well-taken care of".

[–] [email protected] 4 points 1 year ago (6 children)

If you're in an environment that would retaliate against you for unionizing, you're not "well taken care of".

view more: next ›