orclev

joined 2 years ago
[–] orclev@lemmy.world 1 points 5 hours ago (1 children)

Lack of advanced features like generics and a weak type system (although still better than JavaScripts type system). Its library ecosystem is also pretty anemic because it's generally assumed if you're writing Lua it's as part of a script embedded in something else and most of those won't let you pull in random Lua libraries. There are stand alone Lua interpreters that let you run Lua on its own but most people writing Lua code aren't using them and so the community to develop a rich library ecosystem isn't really there like it is in most other languages.

[–] orclev@lemmy.world 1 points 6 hours ago

It's a bit safer and a lot more convenient to use, but still lets you do dangerous things with pointers. At its core it's still fundamentally the same as C just with a bunch of helpful tools and features to make doing all the stuff you do in C easier and more convenient.

Really the biggest thing it does significantly better than C is its macro system. C macros are "dumb" in that the C pre-processor does a simple find and replace on the source files without doing any kind of processing on the underlying C code so you can E.G. write C macros that spit out mangled illegal C code when you run them. Likewise a C #include is literally the same thing as copy and pasting the contents of the included file before it gets fed into the compiler.

Zig on the other hand has a smart macro system that's actually aware of the zig code and works in concert with it at compile time.

[–] orclev@lemmy.world 5 points 11 hours ago

I think that would very much depend on the size of the system. If you're processing a gallon of water a day that's probably true, but if you're doing like 60 gallons a day probably not so much. It sounds like he had a reverse osmosis plant in the island that likely supplied all the water in the island so probably even for things like showers and maybe even swimming pools (I assume he had a swimming pool, it sounds right for a rich douchebag like him).

[–] orclev@lemmy.world 2 points 11 hours ago

Might depend on the source water. The article mentions it's used for water softening so if you're starting with water that has low mineral content maybe it's an unnecessary step.

[–] orclev@lemmy.world 150 points 13 hours ago (35 children)

The records seem to indicate it was used as part of the island's reverse osmosis water treatment system. There I saved you a click.

[–] orclev@lemmy.world 32 points 14 hours ago (1 children)

Oh no, people's genitals will remain un-gropped at airports, how will the country continue to function.

Could they just forget to fund DHS for the next forever, that would be great.

[–] orclev@lemmy.world 1 points 16 hours ago

Interesting. I did find Shenzhen IO to be a bit annoying but that was more because it forces you to use circuit design to solve certain problems rather than just brute forcing them via programming. Weirdly I couldn't get into Exapunks while I found TIS-100 really interesting.

I suspect the reason that they call it Python-like is because I don't believe it allows you to import any libraries or anything into it and they don't want people to think they've got a full Python interpreter that can do all the normal Python things. Essentially it's Python syntax, but without the normal Python runtime. There's probably some more advanced Python-isms that are missing as well, but I've not used Python enough or played the game enough to really run into those things. E.G. I don't know if it lets you define new classes as I never bothered to try that. I kind of got bored of it once I got towards the later levels and didn't really see any reason to keep grinding to unlock what were just extra challenges in the game.

[–] orclev@lemmy.world 1 points 16 hours ago* (last edited 16 hours ago) (2 children)

I'll toss TIS-100 onto the list of programming games although that one teaches you a pseudo-assembly language as well as how to think about concurrent programming. Then there's Human Resource Machine although that one is aimed at absolute beginners to programming and teaches a sort of visual assembly, and then its quasi-sequel 7 Billion Humans which extends the concepts explored in Human Resource Machine into parallel processing (this actually makes a pretty good soft introduction to GPU programming and shaders).

I actually played The Farmer Was Replaced and it's just straight up Python, not even Python-like, it just locks a lot of the language features behind campaign progression. It was OK initially, but gets kind of annoying at later levels because they intentionally hold back a lot of the tools to easily solve problems and make you solve them in a more verbose and annoying fashion first.

[–] orclev@lemmy.world 5 points 17 hours ago (4 children)

So, I can't answer the question of "what's the most fun language to learn" because that's highly subjective and my answer almost certainly wouldn't align with your experience. What I can do though is share my thoughts about different languages I've used over the years (in no particular order).

  • Assembly: the bedrock upon which all other languages are built. If you want to understand how a computer really works, this is a great language to learn, and it's honestly not that hard to learn. Writing something in assembly much more complicated than hello world is incredibly painful because of just how much you need to do and really makes you appreciate how much you get out of the box with other languages, but it's not hard in the "I don't get it" way, so much as "oh god, that's only 1% of what I need to do and it took me an entire day". This is also a great way to develop a deeper understanding of pointers and memory management.
  • C: assembly on steroids. Not quite as painful as assembly because you get a lot of libraries that take care of things for you, but still quite tedious compared to most other languages. The type system such as it is is practically nonexistent so your ability to design APIs is highly limited, and it's incredibly easy to introduce subtle and hard to find bugs. Relatively easy to learn, hard to master, and an act of masochism to use for large projects. At a minimum probably worth learning because C is the de facto interop language any time you want to interface two different languages together.
  • C++: C with the entire kitchen sink of comp. sci bolted on top of it. There's a good language in there somewhere, it's just buried under decades of terrible ideas and half baked experiments. If you know which are the "good parts" and which are the parts to ignore it's not bad, but figuring that out is far from a trivial task and everyone you ask is going to have a slightly different answer. I'd honestly say avoid this one unless you want to spend a couple years exploring all its dark corners and forgotten nooks.
  • LISP (and derivatives like Scheme): ye old functional language. This is basically the assembly of functional programming. It's "simple" to learn, but the lack of features is going to start to grate on you after a while, and the syntax is just horrible. Absolutely worth learning to learn to think functionally, but once you do I'd move to a better language.
  • Haskell: Like LISP but with a masters degree in set theory, a MUCH better syntax, and one of the absolute best type systems ever created. Amazing language that will expand your mind just from learning it but might kill you from a brain aneurysm in the process. To abuse a meme, this is the dark souls of functional programming.
  • JavaScript: A badly designed scripting language that was thrown together from a box of scraps in a cave, but rather than making it better over the years everyone just said "eh, good enough". Its original sin was that in an attempt to make it "beginner friendly" they made the syntax incredibly sloppy which means it's very easy to introduce bugs on accident and then very hard to actually find them because they don't error, they just silently do the wrong thing.
  • Typescript: A better JavaScript in every metric. At the end of the day under the hood it's still JavaScript at runtime so it can only do so much, but the addition of a real type system goes a LONG way towards making JavaScript more bearable to work in and helps eliminate a ton of bugs.
  • Perl: What LISP is to functional programming, Perl is to basic collection types. Scalars (single values), Lists, and Maps are your building blocks in Perl. It's not a bad language exactly, but these days other languages do almost everything it does but better. If there's one significant criticism you could level on Perl it's that the syntax is really easy to abuse to write some truly obtuse code. This is effectively a dead language these days, but it does live on a little bit by being the gold standard in regular expression design that everyone else just copied.
  • Lua: One of if not the best scripting languages currently out there. It's very similar to Perl except it went all in on Maps. It's simple to learn, and simple to master, although that comes with the downside that it's nowhere near as powerful as other languages. Out of the box you don't really get much with it, but since it's designed to be embedded it's really easy to extend and there are versions of it that come with all the bells an whistles you need to use it directly for writing apps. I'm not sure I'd recommend it over another language in general, but if you're looking for a scripting language to embed in something else it's my top pick. The web ecosystem would be a lot less of a mess if Lua had been the language picked at the dawn of the internet instead of JavaScript (to be fair I'm like 99.9% sure Lua didn't exist back then but I'm too lazy to verify that).
  • Python: A competent language. It's not a particularly great language and definitely has some warts, but there's not really anything in the language that makes me go "ewwww" except maybe the significant whitespace, although Haskell does the same thing so it would be hypocritical of me to ding Python for that. It's a solid middle of the road language, nothing really amazing about it, but nothing really bad either. It's biggest flaw is its duck typing system which really limits your ability to write APIs in it. If you want to crunch some numbers it has some really great data analysis libraries and frameworks, although performance isn't anything to write home about either.
  • Ruby: The train wreck that happens when Perl crashes into Python and the mangled remains crawl from the wreckage. It's the terrible syntax of Perl crossed with the middling type system of Python with a sprinkling of bad choices all its own. Performance is horrible and the language has a lot of features that make it easy to write obtuse code. Like Perl this is an effectively dead language. Just use Python or something better.
  • Go: Created in part by one of the guys involved in the creation of C and set out to be a "simple" language that anyone could learn. It does succeed in being simple, but the tradeoff is that it pushes all the complexity that most other languages handle for you onto the programmer to handle. Go programs are going to end up being a lot more verbose and filled with boilerplate than they would be in another language. It also still suffers from an early decision related to its generics system that leads to them being largely useless. Not unsurprisingly working in Go feels a lot like working in C, you often find yourself wishing the language handled a bunch of things for you or at least gave you some syntactic sugar to handle them more concisely yourself.
  • Java: Has a reputation for being verbose but that's more to do with the community than the language itself. Also has a reputation for being slow, and while startup times are certainly a problem at runtime it's surprisingly fast these days. Not a great language, but nowhere near as terrible as its reputation would make you think.
  • Kotlin: Java alternative. Solves some of Javas problems, introduces some of its own. At one point it was the clearly superior choice compared to Java, but since then Java has closed the distance and honestly it's a coin flip as to which is the better language between the two.
  • C#: Microsoft Java. Seriously, everything you can say about Java applies equally to C# and vice versa. It's not a better or worse language, it's just different. Criticisms of C# are less about the language and more about the company behind it.
  • Rust: A type system nearly as powerful as Haskell's, low level primitives that let you write bare metal code, but advanced abstractions that let you write high level code as well, and a truly unique approach to addressing concurrency and memory safety by way of the ownership system. One of the more interesting languages out there and my personal pick for "best" language because it gives you tools to solve some of the hardest problems to deal with in programming.
  • Zig: A better C. Has a somewhat powerful type system a bit like Rust or Haskell as well as a pretty unique and interesting macro system, but ultimately lacks some of the higher level features that something like Rust would give you. It's similar to C in that it it can be somewhat tedious to work with but on the whole not a bad language.
[–] orclev@lemmy.world 5 points 21 hours ago (1 children)

For a newbie probably something like Scheme (which is just a particular flavor of LISP) although I wouldn't call it a good language.

Here's the thing with purely functional languages that don't allow in place mutation (most of them, or only under special circumstances like Haskell's ST Monad), they force you into learning functions that typically don't exist in other languages like foldl and force you to think about approaching problems in a different way. This will make you a better programmer even when working on other languages, but it's very much something you have to learn and like all learning it will take time and effort.

I'm actually tempted to say Haskell is the best option because it actually is a really good language but it's not so much a learning curve as it is a learning grand canyon. It has an amazingly powerful type system (very similar to Rusts) and uses it very well, but it's also very unintuitive because it's deeply rooted in academia and uses names for things taken from set theory and mathematics (terms like endofunctor, profunctor, affine space, and of course the famous Monad). If you're finding Rust a struggle Haskell would be 10 times worse for many of the same reasons.

Another maybe good option that I can't definitively recommend would be OCaml. I've heard really good things about it and what I've seen of it looked good, but I haven't personally used it beyond maybe a little reading and a hello world type thing so I'm unsure what kind of pitfalls a newbie might run into.

The primary reason I'd recommend Scheme is because it's in many ways a very primitive language. Its type system is very simple and it really doesn't have a lot going on other than being purely functional. That is also its biggest downside with its second biggest problem being a rather annoying syntax (be prepared to spend a lot of time counting parens to make sure you're closing every pair and working in the scope you think you are).

[–] orclev@lemmy.world 3 points 1 day ago (1 children)

Stand your ground is about removing the duty to retreat from an attacker if at all possible before defending yourself. It has nothing at all to do with, by his own admission, an accidental discharge. You're right that it's likely due to Texas being a backwards ass shit hole, but it's not because of stand you ground, more likely they just had a bunch of MAGA asshats in the grand jury and they heard a Trumper shot a liberal and just decided to drop the case.

[–] orclev@lemmy.world 2 points 1 day ago (1 children)

See also the closely related concept of code smells. These are things that aren't necessarily wrong like anti-patterns are because in certain niche cases or in limited amounts they're fine, but they're often an indicator that you're doing something wrong in your code. As a quick example I looked up some code smells in JS and a couple of the examples were using == instead of === and having deeply nested/indented code (E.G. have if blocks inside of if blocks inside of if blocks inside of a for loop).

 
view more: next ›