Programming thread

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
Why does "main()" need to be classed as an integer in C?
The return value of the main function is what is returned to the operating system on exit. A return value of 0 denotes a program completing successfully. In a Linux bash script, a C program which fails to return 0 will cause the script to terminate.

With some programs alternative values represent a certain error. It's conceivable to return a 1 for an IO error or a 2 for user input. These are usually documented in manual pages.
 
I want to write a quick love-letter to this book, Designing Data-Intensive Applications. If you want to dive into databases, distributed systems, or anything involving the Internet, it's a great read. There's almost no code, just explanations and examples. For instance I'm wanting to learn more about database replication, there's a whole section on how they're implemented from a systems perspective and fault patterns of those systems. It's one of the few books I would recommend for programming or software engineering.
 
I'd love to see that if you don't mind :)
Excuse me if I make a mistake. I'm not going to write a working program, and I'm not at my usual setup right now.

So, here's an enumeration type in Ada:
Code:
type Traffic_Light is (Red, Yellow, Green);
Types in Ada have attributes. As examples, Traffic_Light'Pos returns the zero-indexed position of a value of the type, whereas Traffic_Light'Val does the opposite. There are a lot of very convenient attributes like First, Last, Image, and Value, but I won't get into them any.

Here's an array type definition using the earlier type:
Code:
type Expected_Acceleration is array (Traffic_Light) of Integer;

We can define a value of the type like so:
Code:
Laws : Expected_Acceleration := (Green => 1, Yellow => -1, Red => 0);

I could also have written these by position, but I like to use names in all cases, and notice they needn't be in order that way.

So, that's the basic stuff, and it's not really worth it to use Ada 2012 solely to associate a predicate with the type to enforce uniqueness. I don't use Ada 2012, preferring 1995 instead, but the way I'd do it, for constant data and if both were fairly small enumeration types, would be to define both directions as functions and use postconditions instead. The postconditions would just reference each other to ensure uniqueness.

Now, for anything more complex, it would be best to define a generic data type instead. I'll whip up a basic example of that, and examples for the functions I mentioned, in a bit. In fact, one thing the newer Ada standards introduced were so-called container types, fancy things. It'd probably be pretty easy to define a proper group as two maps, with a predicate ensuring the invertible relationship. I'll look into that. Still, if I had to use a group in one of my programs, I'd just use the basic arrays and enforce uniqueness somewhere else.
 
I'd like to start an APL thread here, but I know there would be little participation from others. I've never been able to have a long conversation about APL with anyone else, anywhere.
I'll bite, at least a bit. APL looks like the sort of cryptic code blurts you'd expect from my namesake. I can't really make head or tail of some of the code examples I've seen but it does seem like APL might have helped pioneer vectorized operations on data that one now sees very frequently in R code as well as in Python once numpy and other such libraries are installed. Is that accurate?

EDIT: Also what is even the preferred way of hammering out APL code? I prefer to use Vim and it looks like there's some support there.
 
I fucking hate front end libraries and these bullshit apis.

Vanilla Javascript and html is fun and honestly not even that difficult to work with.
React is dogshit. .liquid is tiresome. Bootstrap is great. Jquery isn't so bad either, but I mean that in a condescending way like a racist southerner telling a black guy he is 'one of the good ones'

There, I said it. Vanilla javascript is way too demonized. But I acknowledge my opinion is probably dumb because I'm a front end dev, so I'm like the burger flipper of coding.

I'm only learning this extra bullshit because I have to to make money. I'd be fine with sticking to vanilla html/javascript. I love bootstrap though cause css is a pain in the urethra.
 
I fucking hate front end libraries and these bullshit apis.

Vanilla Javascript and html is fun and honestly not even that difficult to work with.
React is dogshit. .liquid is tiresome. Bootstrap is great. Jquery isn't so bad either, but I mean that in a condescending way like a racist southerner telling a black guy he is 'one of the good ones'

There, I said it. Vanilla javascript is way too demonized. But I acknowledge my opinion is probably dumb because I'm a front end dev, so I'm like the burger flipper of coding.

I'm only learning this extra bullshit because I have to to make money. I'd be fine with sticking to vanilla html/javascript. I love bootstrap though cause css is a pain in the urethra.
In my limited excursions, Vue3 and Typescript approaches something usable.
Dynamic typing is unacceptable though, languages at a minimum should require you to define duck typing through shit like Python protocols, C++ concepts, or something equivalent.
 
Vanilla js sucks but in different ways, it's really choosing between a douche and a turd. What I like about react/jsx is it allows me to write webshit as quickly as possible and get back to a real language, having to manually map state to the dom is probably aids but I've never tried to do it with non-trivial state. Laravel is nice but then you have to run PHP on a server, which isn't nice. Bootstrap sucks, use tailwind, I doubt Twitter even uses bootstrap anymore and they made it.

Also it's bloated as fuck but I like how you can use rust tauri to make a lightweight binary that just renders your site and you can use react/jsx to model arbitrary state (i.e. not just json from an API call but anything you can obtain from inside rust and pass through Tauris API to jsx, which means literally anything). It makes it easy to create guis without dealing with 1980s style GUI code like gtk.
 
Last edited:
Vanilla js sucks but in different ways, it's really choosing between a douche and a turd. What I like about react/jsx is it allows me to write webshit as quickly as possible and get back to a real language, having to manually map state to the dom is probably aids but I've never tried to do it with non-trivial state. Laravel is nice but then you have to run PHP on a server, which isn't nice. Bootstrap sucks, use tailwind, I doubt Twitter even uses bootstrap anymore and they made it.

Also it's bloated as fuck but I like how you can use rust tauri to make a lightweight binary that just renders your site and you can use react/jsx to model arbitrary state (i.e. not just json from an API call but anything you can obtain from inside rust and pass through Tauris API to jsx, which means literally anything). It makes it easy to create guis without dealing with 1980s style GUI code like gtk.
I can see your point of view.

I don't have much experience with back end stuff. Learning C and Rust is high on my list of things to do, but at the moment I'm working on editing templates and setting of shopify stores so I can start making some regular income from programming.

Alot of people on here seem to be more experienced than me and often do back end side of things, so I'm sure once I get more experience with lower level code and back end development my opinions on javascript will change.
 
Say, does anyone want to talk about the network model of databases? I like it more than the relational model.
I'll bite, at least a bit.
I'm not baiting, honest.
APL looks like the sort of cryptic code blurts you'd expect from my namesake.
Sure, but anything looks cryptic if someone can't read it.
I can't really make head or tail of some of the code examples I've seen but it does seem like APL might have helped pioneer vectorized operations on data that one now sees very frequently in R code as well as in Python once numpy and other such libraries are installed. Is that accurate?
Yes, APL is a language in which many things happen, at least conceptually, simultaneously. Getting into this mode of thought, and out of the word-at-a-time mode of thought, is very important to advance as a programmer, I think. I can easily recommend reading this paper by John Backus about a similar language he designed, FP. APL doesn't go far enough in some respects. This paper may seem daunting, but it's actually not very hard to read, and he explains the hardest parts very well.
Also what is even the preferred way of hammering out APL code?
Someone wrote an APL mode for GNU Emacs, gnu-apl-mode, which I use. The input method uses a period as the prefix key. That may seem inconvenient, but it's not when the entire program fits on a few lines anyway.
I prefer to use Vim and it looks like there's some support there.
Yeah, Vim probably also has decent support.
Dynamic typing is unacceptable though
Dynamic typing can be fine, it's weak typing that's the problem.
 

Attachments

  • Like
Reactions: Jarry Seinfelt
I fucking hate front end libraries and these bullshit apis.

Vanilla Javascript and html is fun and honestly not even that difficult to work with.
React is dogshit. .liquid is tiresome. Bootstrap is great. Jquery isn't so bad either, but I mean that in a condescending way like a racist southerner telling a black guy he is 'one of the good ones'

There, I said it. Vanilla javascript is way too demonized. But I acknowledge my opinion is probably dumb because I'm a front end dev, so I'm like the burger flipper of coding.

I'm only learning this extra bullshit because I have to to make money. I'd be fine with sticking to vanilla html/javascript. I love bootstrap though cause css is a pain in the urethra.
As a Java fiend, I must say that out of all of the Web Frameworks Angular is my favorite. It favors dependency injection which allows for easy testing and mocking. Shame that it's fallen out of favor as react began to take over the ecosystem.
 
Jonathan Blow did another Q&A for the Jai compiler, it's coming up on 10 years since he started the project, been in beta for about 2-3.
"An aesthetic for simplicity." He says.

That's why in Java I use Runnable instead of creating a new domain specific interface for every time I need a `void run_this()`, unlike how I see other people do.
 
  • Agree
Reactions: Anti Snigger
I'm learning Go for web dev but was surprised to see in the StackOverflow survey it has about as many users as Rust. Since I'm trying to get into the industry, how many people use Go regularly in their jobs?
I want to write a quick love-letter to this book, Designing Data-Intensive Applications. If you want to dive into databases, distributed systems, or anything involving the Internet, it's a great read.
O'Reilly is the shit.
 
  • Like
Reactions: Marvin and y a t s
I'm learning Go for web dev but was surprised to see in the StackOverflow survey it has about as many users as Rust. Since I'm trying to get into the industry, how many people use Go regularly in their jobs?
I use Go very occasionally at work. I like it fine, I’m not an expert or anything, but it’s pretty clear what the designers’ goal for it is.

I’m not at all in touch with the general Golang or Rust communities the way I am with other languages I use regularly, but I would definitely learn Go over Rust for employability purposes. Honestly, the weird Rust troon meme shit like cargo-mommy isn’t a big reason for that. It’s more because Rust tends to introduce significant changes on a way more frequent basis than a boring corporate language like Go/Python/Java, and from what I know the community of professional Rust developers hasn’t really coalesced around a handful of canonical libraries for ubiquitous needs like testing and database integration. Rust’s borrow checker and type system aren’t really that hard to learn unless you’re bootcamp cattle, but on the corporate scale those things might be big enough hurdles for a company to not want to use it. Go isn’t as autistic with how it wants you to write code as Python’s significant white space is, but it’s generally really easy to understand what any arbitrary Go file/function does IME.

Go is pretty clearly intended to be used for backend services, ops tooling, and basically anything where you want to be able to distribute an executable with minimal bullshit, and my experience has been that it’s pretty good for those IMO. Maybe someone who actually writes a lot of Go regularly can correct me here.
 
Maybe someone who actually writes a lot of Go regularly can correct me here.
I'm probably that someone now lol. Looks good to me.

Jewgle's motivation was clearly to have a nice and reasonably portable compiled language optimized for running and interacting with web services with its very central concurrency support and the various built-in sync primitives. Basic stuff like channel buffering as a way of configuring read/write blocking between threads is immensely powerful when combined with a good select statement (like switch, but for channel selection). It feels a lot like C, but without a majority of the hassle of memory management across threads. This makes it about as easy as writing python, while giving you the power of C with its pointers and low-level kernel stuff.

I enjoy writing Go a lot. Rust's constant nannying only pisses me off.

Edit: Also, if you run a public web server, take a look at your access logs. You'll often see Go http clients used for automated requests like those cgi-bin ones they use to build botnets. The easy threading makes it much nicer than Python for scraping and similar work.
 
Last edited:
Everyone looking to learn Go should know what its creator had to say about it:
Rob Pike said:
The key point here is our programmers are Googlers, they're not researchers. They're typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They're not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt.
 
I like Go because the spyware is built into the compiler, you no longer have to give Google your data manually, they'll just transmit from your machine when you use their Open Source language. It's more efficient than the way it was done before.

Everyone looking to learn Go should know what its creator had to say about it:

As I said before, I'm a newbie. But fuck google, anything you can do with GO you can probably do with Ruby, Nodejs, C, or Rust so even a dipshit with no college or experience like me would figure using Googles api is like playing ball with a demon.

Well I can also say that from experience, seriously, fuck google. I tried making an smtp script and emailing myself and google locked me out of my email accounts for a month and I found out the hard way that they literally have no customer service department. What in the fuck?

Fuck google. You couldnt pay me enough to use Go.
 
As I said before, I'm a newbie. But fuck google, anything you can do with GO you can probably do with Ruby, Nodejs, C, or Rust so even a dipshit with no college or experience like me would figure using Googles api is like playing ball with a demon.

Well I can also say that from experience, seriously, fuck google. I tried making an smtp script and emailing myself and google locked me out of my email accounts for a month and I found out the hard way that they literally have no customer service department. What in the fuck?

Fuck google. You couldnt pay me enough to use Go.
In the future, I would recommend standing up a mock service on your own machine for stuff like this and testing there. Sounds like you tripped a rate limiter.
 
Back