Imagine Star Trek replicators but they work at the speed of modern 3d printers so Picard says "Tea, Earl Grey, Hot" and comes back 12 hours later to find half a cup, random glass fibres everywhere, and tea dripping on the floor.

reshared this

in reply to Mx. Chara Aznable of Pnictogen

@Mx. Chara Aznable of Pnictogen @Pseudo Nym @Hugo Slabbert ⚠️ @patrislav ♾️ #RIPNatenom because they pollute the global namespace and make testing more complicated. They have their place, but it's often preferable not to use them.

Edit: in the example from the meme, "hot" was a relative term, and should not have been defined globally, because changing its value in one place led to unexpected behaviour elsewhere.

in reply to Mx. Chara Aznable of Pnictogen

@mxchara @patrislav @hugo

Like the meme above, confusion about purpose, side effects, unintentional / unexpected behavior changes.

Even environment variables are scoped to the processes and subprocesses under which they are set.

Set a global ENV variable, modify it in subchild 1, and that change is isolated and doesn't change parallel subchild 2.

in reply to Pseudo Nym

@Pseudo Nym @Hugo Slabbert ⚠️ @patrislav ♾️ #RIPNatenom @Mx. Chara Aznable of Pnictogen To be fair, a global variable is also generally scoped to the process inder which it is set. It doesn't generally exist outside of it.

Environment variables are one of those concessions we make when we want a quick and dirty way of passing a value from a process to a subprocess (though threre's also command line arguments). It's about knowing which tool is right for the job.

in reply to Pseudo Nym

Pleb thinks setenv is global lol

int fd = open("/dev/shm/reallyreallyglobal", O_RDWR|O_CREAT, 0666);ftruncate(fd, sizeof(int));int* mem = (int*)mmap(NULL, sizeof(int), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);close(fd);*mem = 42;int pid = fork();if(pid == 0) { usleep(drand48()*123); *mem = 23; exit(0);}waitpid(pid, NULL, 0);pid = fork(); if(pid == 0) { usleep(drand48()*123); printf("Now THIS is a global %d\n", *mem); exit(456);}waitpid(pid, NULL, 0);

in reply to patrislav ♾️ #RIPNatenom

@patrislav a lot of times they visit support sites populated by "colonists" who live in squalor, they are always mining something, maybe that is the raw stuff for the replicators that "the little people" have to keep moving
This entry was edited (yesterday, 11:44 AM)

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.