Fork me on GitHub

Because people don’t see the benefit of relearning everything to avoid mutable state


It is quite a shift in thinking


immutability also has performance costs right?


I guess you're saying it should be the default, not that mutability shouldn't also be available.


Not necessarily, but immutable-by-default seems to have a much stronger set of benefits for many things


I think it makes sense to have mutable datastructures available when needed, but immutable datastructures have good enough ™️ performance now that reaching for mutable structures right away for performance reasons is a premature optimization.


And should probably be kept to the specific locations your perf profiling has identified as being hot spots.


I believe this is one of the key problem areas. People rely too much on "perf profiling" and often misunderstand the results, which leads to inaccurate assumptions and poor decisions based on those.


Re: a shift in thinking, I think that's part of it, but another part is probably that it doesn't get talked about much. Typing is a popular flame-war, but mutable vs. immutable doesn't seem to be.


I'm not sure why.

Vincent Cantin06:01:41

My theory on this: mutable data users mostly don’t know immutable data users, or consider them too weird to argue with … until they start to understand the benefits of immutable data and become themselves immutable data users.

Vincent Cantin06:01:20

Another reason is : inside each mutable data user, there is a part time immutable data user …. i.e. const. 😆


in bash, how can I compare the result of this in a conditional, saying “greater than zero”:

errors=$(cat out/output.txt | grep FOO | wc -l)


I’m trying this:

echo $errors
[ "$errors" -gt "0" ]; echo "yes"


so it kinda not works


it seems wc -l puts a tab or something in the result


I should be using grep -c


$ echo $errors
$ if [[ $errors -gt 0 ]] ; then echo "yes"; else echo "no" ; fi


ah, so you need two square brackets…?


Yeah, bash is weird that way. Something about “double-square-brackets == boolean” I think? Been a while, my bash skills are rusty (not that they were all that great to start)


but anyway, yeah, double-square-brackets for if


it also works with single ones 😉

Lennart Buit19:01:01

fun fact, there is actually a binary called [ on the average unix system

Lennart Buit19:01:46

If you have a shell without a [ built-in, it can fallback to that actual binary. Shell scripting is strange like that


what does that binary do?

Lennart Buit19:01:19

the same apparantly, I am unsure why it is a builtin in zsh/bash


I'm guessing, but probably to avoid the overhead (fork/exec) of calling a binary just to evaluate a boolean expression.

Lennart Buit19:01:20

hmm yeah makes sense, but is asking for compatibility problems


I imagine the source is identical, or there is a very insidious set of standardized tests.

Alex Miller (Clojure team)21:01:38

if you haven’t found it yet, I find shellcheck to be immensely useful in checking bash stuff


I read about it on the Haskell reddit but never actually tried it. Thanks for the link!


That looks fantastically useful. Thanks!


The only thing where shellcheck doesn’t make a good suggestion imo is this one:

Line 21:
clojure -A:test:coal-mine:coal-mine-generator out/out.cljc $problem
>>                                                         ^-- SC2086: Double quote to prevent globbing and word splitting.

Did you mean: (apply this, apply all SC2086)
clojure -A:test:coal-mine:coal-mine-generator out/out.cljc "$problem"
Wrapping the variable in quotes is passing an extra argument, while I want to ignore it when it’s not set.


Maybe there’s a better way in bash to do this.


probably this:

clojure -A:test:coal-mine:coal-mine-generator out/out.cljc ${problem:+"$problem"}


Now using it as a linter in emacs.

Lennart Buit21:01:11

I found out the hard way that MacOS shell scripting is quite different from Linux. Linux utils have so much more options compared to their BSD counterparts shipped with MacOS

👆 10

Can't you brew more standard shells onto MacOS?


Or is this a /bin/sh kinda deal? :/

Lennart Buit21:01:18

its not the shell, its the (what would on linux be called) core utils


You can install the Linux versions AFAIK


I seem to remember doing it


Might that start to break made for mac kinda stuff though? Like a system update.

Lennart Buit21:01:40

Yeah, not going to attempt that :’). Its not bad perse, I just thought that the BSD family of core utils was closer to the GNU family of core utils.


This is the deal with being "unix-like". OSX is neither Unix nor Linux, but people keep trying to compare one or the other to it.


i think mac is certified as a unix


Right and we're talking Unix vs UNIX(R) Certified. As per the Wikipedia page ( - The UNIX trademark passed to The Open Group, a neutral industry consortium, which allows the use of the mark for certified operating systems that comply with the Single UNIX Specification (SUS). As of 2014, the Unix version with the largest installed base is Apple's macOS.


you claimed that > OSX is neither Unix nor Linux, but posted a link from the UNIX trademark owner that > As of 2014, the Unix version with the largest installed base is Apple's macOS.


i don't follow.


I explained. Unix vs UNIX(R) Certified. There's a difference that is explained in my previous message.


I also didn't write the Wikipedia article. As with any Wikipedia article there may be inaccuracies within the page. The purpose of linking the two pages was to show the difference.


Ah cool. I'll read them more carefully later. Thanks for the articles

👍 5

It is far older than that ;)


They get added as g + <name> by Homebrew as far as I know so no clashes

👍 10

That is ideal. You could go crazy and chroot into a sane scripting environment and everything, too 😀

Lennart Buit21:01:04

off topic off topic: How often chroot has saved my Arch install :’)

👍 10

Quite 😀

Lennart Buit21:01:57

dual boot with Windows, and NVIDIA drivers

Lennart Buit21:01:10

Great ways to kill your Arch

facepalm 5

Nvidia on Linux has been the bane of my life... It's like tossing a grenade in the kernel.

Lennart Buit21:01:15

Have a love/hate relationship with it, I like that it at least provided performant drivers for linux

Lennart Buit22:01:42

But the ArchLinux tooling is great, even if you borked your kernel and it doesnt boot, boot from USB, chroot and fix whatever you broke

Lennart Buit22:01:45

The fact that ArchLinux is so barebone makes system maintenance so much easier

Lennart Buit22:01:23

But yeah, maybe not run it on your production cluster


You'd better be insured ;)


Fellow Arch user here. Follow the instructions on the Nvidia Arch Wiki page and it works just fine. Miss some of the key steps on there and you'll see issues. I'm running nvidia blob and have better performance than my Winblows installation and am running Steam Native just fine.

👍 5

Per your initial statement - you shouldn't need to boot into a live usb key. That's what the fallback kernel is for


Here's one that is specifically helpful that is often forgotten (I know I did) -

Lennart Buit07:01:17

I don’t really know the exact circumstances, but part of the problem was having a relatively tight root partition (10G or so). Maybe I could restore with the fallback, but windows breaking my bootloader had me use the USB and that was what was familiar