Programming thread

The 1-Wire is the 'slowest' which just means I kick it off and then come back 750mS later
Well, almost. The bus transactions are also slow. It can take nearly 10mS to get a data readout as the bus is designed to be slow and large. My main loop will be unhappy with more than 1mS blocking. So I can find better 1-Wire libraries using non-blocking or timers, or make/update my own. Or, what I'm leaning towards is taking an ATTiny, slapping an Arduino Core on it and having it poll the bus and spit out results in async serial, which the Pico can then lazily consume.

And now, back to my day job, today involving CI/CD and Python, yay.
 
Any Ziggers in here? If so, what do you think of Zig, and would you recommend it?
I looked at learning it a while ago as a low-level language and gave up because the documentation was shit and standards were changing or deprecated with some expected things just not having a replacement. It's probably in a better spot today though as that was 0.11 and it's at 0.14 now.
The main selling points are excellent interoperability with C (you can import C files without any retarded wrappers), a build system that uses the language itself instead of some moronic DSL such as makefiles and convenient features such as defer, option types, etc. Its tooling is far from ready, tho, and it forces you to write boilerplate for example, you need to "consume" the return value of function which amounts to putting _ = before function calls otherwise it won't compile.
The C interop and non-retarded syntax was what attracted me to Zig initially along with these claims:
  • No hidden control flow.
  • No hidden memory allocations.
  • No preprocessor, no macros.
I fucking hate hidden magic stuff in my code, from times when I worked on Java Spring apps and the god awful dependency injection that went with them.

Comptime stuff in Zig also just seemed like a fancier preprocessor to me.

I learned a bit of Rust instead and all I'll say is that language can be annoying as fuck to write simple stuff in and treats the programmer like an idiot child (which is often true). It's still an okay programming language, but mostly because of its type system in my opinion.
 
it forces you to write boilerplate for example, you need to "consume" the return value of function which amounts to putting _ = before function calls otherwise it won't compile.
why the fuck
this is some of the most retarded bullshit i ever saw
oh wait i remember now it also errors if you have an unused variable
0/10 niggerlicious language with retarded overly pedantic compiler, avoid at all costs

just seems like one of those languages that attempts to "fix c" without actually knowing what c's issues are, so they end up wasting an unholy amount of work making a worse c
 
oh wait i remember now it also errors if you have an unused variable
If only they had spent 3 minutes with C...

Code:
$ cat main.c
__attribute__((warn_unused_result)) int seven() {
  return(6);
}
int main() {
  int i;
  seven();
}

$ gcc -Wall -Werror main.c
main.c: In function ‘main’:
main.c:6:5: error: unused variable ‘i’ [-Werror=unused-variable]
    6 | int i;
      |     ^
main.c:7:1: error: ignoring return value of ‘seven’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
    7 | seven();
      | ^~~~~~~
cc1: all warnings being treated as errors

You can get all the errors you want. And more importantly, shut them up.
 
If only they had spent 3 minutes with C...

Code:
$ cat main.c
__attribute__((warn_unused_result)) int seven() {
  return(6);
}
int main() {
  int i;
  seven();
}

$ gcc -Wall -Werror main.c
main.c: In function ‘main’:
main.c:6:5: error: unused variable ‘i’ [-Werror=unused-variable]
    6 | int i;
      |     ^
main.c:7:1: error: ignoring return value of ‘seven’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
    7 | seven();
      | ^~~~~~~
cc1: all warnings being treated as errors

You can get all the errors you want. And more importantly, shut them up.
This is my favorite aspect of languages like C and JavaScript. The language has been separated from the tool (compiler, linter), allowing you to choose your tools and more freely express your own code style without unwanted nagging. Almost all nu-langs fail in this regard: Go, Rust, Zig, the tool is synonymous for the language.
 
This is my favorite aspect of languages like C and JavaScript. The language has been separated from the tool (compiler, linter), allowing you to choose your tools and more freely express your own code style without unwanted nagging. Almost all nu-langs fail in this regard: Go, Rust, Zig, the tool is synonymous for the language.
this is exactly it, the designers think that they are making an "ecosystem" and shit instead of just the first program that turns their gay language into machine code
 
Any novel innovations in languages are already in a Lisp. I thought I was clever when I was trying to come up with my own language some pages back now, but I was pleasantly surprised to find that anything I could have possibly added was already in the Lisp I settled on (Clojure).

"Innovations" in languages these days are just about making them as pajeet-proofed as possible. Thus cargo/go get replacing NPM, thus a single source of truth replacing a spec and a variety of compilers and platforms, etc.
 
Any Ziggers in here? If so, what do you think of Zig, and would you recommend it?
Whether Zig structs are passed by value or by reference is intentionally up to the compiler on a per-function basis because copy elision is hard or something, which causes all kinds of funny aliasing bugs and makes me think the author is an idiot.
 
Whether Zig structs are passed by value or by reference is intentionally up to the compiler on a per-function basis because copy elision is hard or something, which causes all kinds of funny aliasing bugs and makes me think the author is an idiot.
if i understand correctly this sounds just like normal copy elision except it's UB to mutate anything passed by value because fuck you
this easily wins the kiwi farms niggerlicious programming language award in the category of "makes c++ look really simple and intuitive"
 
Any Ziggers in here? If so, what do you think of Zig, and would you recommend it?
At the end of the day, language creators need to understand that what they're doing is essentially giving a programmer a loaded gun. You can cover the gun in warnings and all kinds of devices to try to make sure they use it properly, but you can't really stop someone who is determined to shoot their cock off with it from doing exactly that. Zig has a lot of interesting features, the C interoperability specifically looks neat and the built in defer/errdefer is nice, but the author seems to have gone quite a bit past "give them the features to not make jeetcode" and right into "you must write this my way because then you can't make jeetcode" which is just a false assumption. You can always make jeetcode, just like you can always find a way to shoot yourself with a loaded gun so long as it can actually fire.

My perfect example for this is how the language really, really wants you to do some nice error handling by trying to hogtie you into using try/catch, but any shit-covered jeet worth their caste is just going to copypaste some empty error discarding code block into every line requiring such and utterly ignore the intended result of that language feature. There's more, of course, but this is just the best example because it's something they already do a lot in other languages that seems to have not been considered or understood here.

So yeah it's not as bad as Go or one of those other fag languages but it's still kinda pointless as of yet. We'll see where it goes.
 
Genuine question, why C/C++ had become the defacto language for most programs and Lisp hadn't got away with being used in user software as much as C?
 
  • Like
Reactions: Polyarmory
1) Indians can't write Lisp.
2) Lisp runs on a platform, (like how java runs on JDK, C# on .NET, etc.) which made it historically expensive to be used to compute things, so it wasn't universally spread like the ALGOL descendants. Only (relatively) recently did hardware get good enough to run Lisps. There were historically dedicated Lisp machines, but they were expensive.
 
This isn't really true.
You're thinking of current software, done in high-abstraction languages such as Java or Python. Historically, most programs are written in C++ due to what it could do if you knew how to use the memory pointers well, and a lot of institutional push towards it's standards.

Still, I wish I had proper Lisp classes, that language is really cool.
 
  • Feels
Reactions: Creative Username
You're thinking of current software, done in high-abstraction languages such as Java or Python. Historically, most programs are written in C++ due to what it could do if you knew how to use the memory pointers well, and a lot of institutional push towards it's standards.
Current software is most software.
 
Back