Maybe he did, or maybe he was just inspired by prior art. Programming languages rip off each other all the time. Java and C#, for instance, ripped off a lot of C++ syntax.
yes obviously - im not saying that's a bad thing. just that from my view, it looks like the author's delegated so much work to the LLM that they themselves don't know the ultimate provenance of much of their own language.
this is a big tell i've noticed with new programming languages these days. 1 - they're increasingly being built using LLMs, with the AI doing more and more design work, not just implementation, and 2 - the human author never acknowledges prior art, because they didn't bother to survey the existing landscape, so they present it, as if this is some new novel thing that's never been done before.
it's one thing to copy from another without attribution, another to independently discover or build the same or similar thing as another, but this is something entirely: to direct an agent to build a language for you, and it copies from prior art and you yourself are unaware of how much was copied and where it came from.
You should read the depictions of roman gladiator games pitting elephants against human. It will make you cry for "beasts" that lived 1000s of years ago.
I think that's the point, animals being sentient doesn't mean we consider them as having the same personhood that we ascribe to fellow humans, though gladiator games obviously also subject humans themselves to this abuse.
Laziness is fundamental to Haskell: that's its raison d'être. If you look at old Haskell code and Haskell code from nowadays, I don't think formal verification (in the sense of automated theorem proving) was ever anyone's priority. In fact, old Haskell seems even more cowboy-like in the old days compared to how it is today. People were totally fine with leaving unhandled cases because their proof on paper demonstrated that those cases were unreachable, for instance. They often abused circular or infinite lists a lot more for the sake of a short, elegant implementation. To be honest, while Haskell shares syntax with some theorem provers, Haskell itself has a certain attitude that isn't really shared by any other programming language, an attitude which favors brevity and which gives freedom to the programmer, the opposite attitude to that of a theorem prover. Laziness is a big part of that. It allows the programmer to write seemingly mathematical code without actually having to prove it formally.
There's widespread agreement in the community, by the people who designed Haskell, that if there is a next Haskell, it should be strict.
Exploring laziness was one idea behind Haskell, one of many. And we learned a lot by doing it. But we also learned that the costs (in terms of execution, complier complexity, debugging, and even internal consistency in the language) are extremely high.
Laziness is not what lets you do equational reasoning in Haskell. The fact that you manage side effects, that's what lets you do equational reasoning. That is a feature of the type system, it has nothing to do with laziness.
First, I said that laziness allows the programmer to write seemingly mathematical code without actually proving it, not that laziness is the sole thing that lets you do equational reasoning.
But on the subject, laziness plays a considerable role in equational reasoning. Equational reasoning is simplified by it. For instance, these two expressions are equivalent in Haskell, but are not equivalent in a strict language.
let x =
in if then x else
if then else
Hence you can apply the rule that "let x = in " is equivalent to with x inlined, other than that the computation is only done once.
Or if "f" is a function that is equivalent to "const 1", then "f (1 `div` 0)" should simplify to 1, not to bottom.
It also lets you write this kind of code (taken from Rosetta Code):
primesSA = 2 : prs
where
prs = 3 : sieve 3 [] prs
sieve x fs (p:ps) = [i*2 + x | (i,True) <- assocs a]
++ sieve (p*p) fs2 ps
where
q = (p*p-x)`div`2
fs2 = (p,0) : [(s, rem (y-q) s) | (s,y) <- fs]
a :: UArray Int Bool
a = accumArray (\ b c -> False) True (1,q-1)
[(i,()) | (s,y) <- fs, i <- [y+s, y+s+s..q]]
In this case, not having to prove totality makes the rest of the code easier. I deliberately chose this example and not the classic 3-line version with trial division because it's not inefficient and yet it still uses laziness to make the program simpler.
And historically the reason why laziness was favored was because it enabled modularity better.
That is partly why I think laziness is worth having.
A Haskell without laziness would basically be a programming language from a different tradition. It has never been a "correctness at all costs" programming language, as I already stated in my previous comment. It may be that such a programming language is what those who design it want, but that isn't what it is.
To me, Gemini feels like the least intelligent LLM I've tried. But I would agree with your assessment that GPT acts more like a tool than do the others.
Or else you could have "loadConfig()" be a method that returns a reference, which is in turn the member of a class, so that there isn't any dangling reference issue.
They admitted it was a trick question. I just don't think it would have been written as they wrote it by anyone who knew C++ to a decent level in the first place. Maybe that makes it a stumbling block as you're learning it, but it seems obvious to do the simplest thing first, at least in my view.
(Also, this is at least in part inherited from C. Dangling pointers themselves are due to C. And temporary expressions are just acting consistently with C semantics here.)
IDK, I just like C++. I don't think that's the reason. It doesn't feel that good to get something done in C++, and it doesn't feel like a puzzle; it just feels mostly straightforward. The language which is actually like a puzzle and which feels good to write is Haskell, in my opinion, but it's not always as easy to get stuff done in Haskell. I suppose this is why many Haskell coders moved to Rust.
But that only happens if you fail to learn everything in modern C++. If you want to know everything about C++ inside and out, it seems best to start with learning C inside and out, and then to learn which practices have been superseded by better alternatives in C++ and how C++ has changed them, e.g., how initialization has been complicated.
The problem is that many end up writing C style code in C++ and never bother with best practices, unless they have a proper mentor refusing PR for example.
reply