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.
Using PHP for the first time to make a simple webapp with minimal dependencies. Thoughts so far:

1. Overall idea of the language is great. Stateless per-request execution while allowing code to freely mix with HTML lets you whip out a prototype really fast. There's a reason the retards in Javascript land have spent the past decade reinventing it through the React + JSX circus.
2. Syntax sucks ass, using "$" as a variable prefix was a a horrible idea. Fuck Perl for starting this shit.
3. Standard library is a fucking trashheap. mime_content_type() can't even get the right result for a goddamn CSS file. Had to copy paste some asshole's code from the comment section like it's 2005.

Overall, it's not too bad. I do wish some hipster had taken the time to write a thin syntax level wrapper that makes it all more palatable. (Sort of like Elixir/Erlang or Typescript/JS.)
Does php not use libmagic for this? If it does, it might be an issue with your libmagic install.
 
  • Like
Reactions: Belisarius Cawl
30 minutes later and now I feel like everyone who has ever called memory management difficult (including myself, thirty minutes prior) is a complete retard. Memory management isn't difficult, ownership is difficult, and you have to deal with ownership when programming anything anyways.
The issue with memory management is that it's repetitive and error-prone while often having terrible consequences when done incorrectly, which is a combination from hell. The difficult part isn't to understand it, it's to consistently do it correctly without automation; hence the automation.
Perl in turn got that from Unix shell conventions
Stephen Bourne should be tried at Nuremberg.
 
What features do you want in your programming language?
I basically just want to take Lua and add a collection of my favorite features from other languages:
  • Strong typing, error and null optionals. Immutability by default.
  • Pascal-like syntax e.g. do .. end
  • Implicit interfaces from Go.
  • Pattern matching from functional languages.
  • Expression piping so you can chain functions together.
  • Structured data in the form of structs, and validation on structs as first-class variables.
  • Fast, preferably compiled, if not then JIT-ed.
  • Control structures as expressions, with named returns in loops, so I can do something like:
C-like:
int x = for(int i=1; i<=10; i++)(int acc=0) {
    acc += i;
} // x now equals acc at the end of the for loop, 55.

Part of me wants to post some informal specs/examples, but I don't really want to be caught dead posting on the farms if I end up pushing it somewhere, lol. I also don't want to derail, so unless I have anything else to share about it, I'll digress.

Contributing to the thread, did anyone see about that Godot-based virus over the weekend? After the woke meltdown, getting their reputation hit back to back like that must suck (not that they don't deserve it).
 
Last edited:
I'm sick at the moment and slightly feverish. Last night I had a dream over and over that I was trying to attach an event listener to my alarm clock. It's a real physical alarm clock so don't ask me how it makes sense I just remember I kept trying to attach and event listener to it or else I wouldn't wake up.

There's probably no real point to sharing this, but perhaps it's a warning about what dabbling in Javascript can do to your mind.
 
There's probably some universal truth hiding in there.

A value is just that, a value. The mapping is nil-> value.
A pointer is a direction to a value. This is a novel level of indirection. The mapping is Pointer->Value.
A pointer pointer is a direction to a direction. This is another novel level of indirection. The mapping is Pointer->Pointer.
A triple pointer is a direction to a direction to a direction. This is not a new level of indirection, since the mapping is still pointer -> pointer.
It goes further than you think, indirections of any arity are homomorphic. Even though we conceptualize a double pointer as being something like a 2d space you can just as easily bake that relationship into your dereferencing using pointer arithmetic. The same is true of triple pointers. After you have one indirection it doesn't really matter how many other layers you add, they can all be collapsed into an arena allocator plus pointer arithmetic.
 
Strong typing, error and null optionals. Immutability by default.
So kinda like rust? ie let mut foo: int = 42
Pascal-like syntax e.g. do .. end
ehh just do it like in scala 3 where the end keyword is optional.
Implicit interfaces from Go.
i really like Go's structural typing, but I really dislike the fact that I cant simply declare an implementation, even if only the Language Server is the only one to do the checking, and it doesn't do anything in the language cuz i am a dumbass at times.
I know you can do this:
Code:
type T struct{}
var _ I = T{}
var _ i = (*T)(nil)
But that is not as simple as T impl I
  • Pattern matching from functional languages.
  • Expression piping so you can chain functions together.
Yes very good features
  • Structured data in the form of structs, and validation on structs as first-class variables.
first part: Yes keeps it very simple,
second part: like Ada or more like the go-playground/validator library?
Fast, preferably compiled,
the only answer
Control structures as expressions, with named returns in loops, so I can do something like:
wouldn't just having higher level functions work in most cases like
Code:
int foo = fold(range(1,10,1), 0, (a, b) => a + b)
? and if you really need more flexibility wouldn't tail recursions work?

I would also like to suggest first class currying and a more restricted form of Uniform Function Call Syntax, and type inference.
 
1733261926577.png
I hate clickbaity bullshit like this. Only retards think that code is not important to care about as a programmer. And that's why the SAD state the industry is in.
 
Last edited:
View attachment 6711381
I hate clickbaity bullshit like this. Only retards think that code is not important to care about as a programmer. And that's why the SAD state the industry is in.
I hate all videos of this general nature. Any advice worth hearing can be found in the docs; everything else is trash.
 
I know w3schools has a really bad reputation, and that it's mostly good for vague memory refreshing tips you need in a moment, but I was looking at their Python stuff, and I found 2 errors, one of them could be just confusing for people learning if they're not careful.
https://www.w3schools.com/python/python_dictionaries_remove.asp

So in one of their exercises the correct answer is supposedly this:
error1.png

But that's not correct I think, they mean this (with square brackets): del myvar['color']


There's also another one, where you expect the output to be accurate once entering their example page, because that was seemingly the case for every other instance, except in here, where you need to manually "Run" it yourself because for some reason the inital output is wrong.
https://www.w3schools.com/python/ref_set_difference.asp

difference.png
 
I know w3schools has a really bad reputation, and that it's mostly good for vague memory refreshing tips you need in a moment, but I was looking at their Python stuff, and I found 2 errors, one of them could be just confusing for people learning if they're not careful.
https://www.w3schools.com/python/python_dictionaries_remove.asp

So in one of their exercises the correct answer is supposedly this:
View attachment 6712519

But that's not correct I think, they mean this (with square brackets): del myvar['color']


There's also another one, where you expect the output to be accurate once entering their example page, because that was seemingly the case for every other instance, except in here, where you need to manually "Run" it yourself because for some reason the inital output is wrong.
https://www.w3schools.com/python/ref_set_difference.asp

View attachment 6712527
I swear I have had similar issues on freeCodeCamp where I did something correctly but the script that they use for their tests says I did something wrong because I did it in a way the person making the test didn't expect.

Educational Websites are doing the lords work, but its pretty funny being the pupil and noticing your master made a mistake.
 
I know w3schools has a really bad reputation, and that it's mostly good for vague memory refreshing tips you need in a moment, but I was looking at their Python stuff, and I found 2 errors, one of them could be just confusing for people learning if they're not careful.
https://www.w3schools.com/python/python_dictionaries_remove.asp

So in one of their exercises the correct answer is supposedly this:
View attachment 6712519

But that's not correct I think, they mean this (with square brackets): del myvar['color']


There's also another one, where you expect the output to be accurate once entering their example page, because that was seemingly the case for every other instance, except in here, where you need to manually "Run" it yourself because for some reason the inital output is wrong.
https://www.w3schools.com/python/ref_set_difference.asp

View attachment 6712527
I remember I had a prof back in the day who frequently would say "I will not degrade myself by going to w3chools." while scrolling past it in search results to bring up some documentation on the projector. That line echoes in my head every time I see its name.
 
Geeks for geeks is most consistently helpful than w3schools or stackoverflow come to think of it
I agree with the overall sentiment I've seen that GeeksforGeeks is a very uneven resource without much in the way of quality control. Packt Publishing is similar but they go into niches that are sometimes not as well-explored by other publishers. (It's worth the risk for $0.00 at least.) One thing I definitely don't like about GeeksforGeeks though is the frequency of pajeet English. The subject matter is often hard enough to navigate without that additional impediment.
 
I agree with the overall sentiment I've seen that GeeksforGeeks is a very uneven resource without much in the way of quality control. Packt Publishing is similar but they go into niches that are sometimes not as well-explored by other publishers. (It's worth the risk for $0.00 at least.) One thing I definitely don't like about GeeksforGeeks though is the frequency of pajeet English. The subject matter is often hard enough to navigate without that additional impediment.
In all fairness I rarely read the articles and I just use it to find math equations or using the article to point myself in the right direction.

For example, I was trying to make a react app redirect to different pages and geeks for geeks had an incredibly helpful tutorial about react router that I didnt read, I copy pasted the boiler plate code and I read about react router in the offical documentation.
 
  • Feels
Reactions: Belisarius Cawl
In all fairness I rarely read the articles and I just use it to find math equations or using the article to point myself in the right direction.

For example, I was trying to make a react app redirect to different pages and geeks for geeks had an incredibly helpful tutorial about react router that I didnt read, I copy pasted the boiler plate code and I read about react router in the offical documentation.
I've definitely used GeeksforGeeks for assistance with Project Euler and other algorithmic challenges
 
  • Like
Reactions: ${Sandy}
For learning resources, I'm going to shill Bing's copilot (the web app not the W11 spyware). If you use it as a teaching material ("Teach me about...", or "Explain...") instead of trying to use it to replace your own thoughts, I find it's really useful to chain questions and actually learn from it, moreso than resources since it's interactive. Plus, you don't have to sign in to use it. I've probably learned more math from it in the last few weeks than from school, lol.
 
Back