Python
They specified statically typed languages. Python would be dynamically typed
Python is dynamically typed by default, but lots of Python is statically typed.
No python is statically typed. You have type hints, which makes the language tolerable but like their name implies it’s a hint at the type. You can perfectly legally pass in something completely different that doesn’t conform whatsoever.
The primary thing static languages provide is static typing, that being the ability to determine before runtime that all the types are valid. A good example of this is how C++ programs will refuse to compile if you try to invoke a method that doesn’t exist on the type. That’s because it’s statically typed. At compile time you know that the code is wrong. Dynamic languages fundamentally don’t work like that. You cannot know until runtime if the method you called or the field you are trying to touch exists or not. Again type hints help a lot with this but that doesn’t change how the language actually operates.
All static typing means is that types don’t change, eg you can’t declare a var as a string and later assign a number to it.
No.
Name one statically typed language that doesn’t have that property. Name one non statically typed language that has that property.
It’s much more involved than that. For example, static type systems involve checking that the functions you call accept the types of parameters you’re supplying then. It’s a necessary part of static typing but alone is not sufficient.
If this code were a valid program in some hypothetical language but only failed at runtime then that would be an example of dynamic typing because the types cannot be verified statically (e.g., at compile time).
var a = 1 a = "a"
But you’re right, I don’t really know of any languages like that. I could’ve sworn I heard this called strong typing but I can’t easily find a source. And strong/weak typing are a mess of definitions nobody agrees on.
C is memory safe if you program it well enough, so I guess C
C? Memory safe? HAHAHAHA
落ち着いてください
いや、そういうしないつもり。その言語は大きなる問題から。
Please work on your Japanese.
Every car has airbags if you drive well enough. Right?
You can still make stupid mistakes in Rust. It may make it harder to make the most common mistakes, but pretending the guardrails are prevent any type of mistake is asking for a problem to happen.
The only one pretending mistakes can’t happen is the person I replied to. Mistakes definitely can happen and no programming language is fool proof.
Continuing my car analogy, would you rather drive a car with airbags and seatbelts or one without them? Of course you can still have a fatal accident, but it’s nice to have safety features that make it as unlikely as possible.
every single language (except V of course) is memory safe if you program it perfectly.
Very, very few humans are capable of doing that, especially with C.
Lol. The people downvoting your comment need to get good.
Skill issue.
Gleam?
https://gleam.run/I dunno it looks well designed but I dunno why I would use it instead of Rust.
Honest question, what would make you pick Gleam over Elixir? Both seem to have significant overlap
Isn’t Elixer dynamically typed?
<?php declare(strict_types=1)
😏 😁
🏃♂️💨
🏃♂️💨
The dash emoji. Always looks like a fart.
🦀
Ada, hands down. Every time I go to learn Rust I’m disappointed by the lack of safety. I get that it’s miles ahead of C++, but that’s not much. I get that it strikes a much better balance than Ada (it’s not too hard to get it to compile) but it still leaves a lot to be desired in terms of safe interfacing. Plus it’s memory model is more complicated than it needs to be (though Ada’s secondary stack takes some getting used to).
I wonder if any other Ada devs have experience with rust and can make a better comparison?
I would use Ada or Spark in a heartbeat if there was an easy-to-use, mature cross-platform GUI library for it.
I have done quite a bit of C, C++, Ada, and Pascal development. I recently got into Rust. I am still getting used to Rust, but it feels a bit like someone tried to apply Ada to C++. I like the modern development environment, but I am slower writing code than I would be in Ada or C++. The one feature of Ada that I really like and want other languages to adopt is the Rep spec. I write driver code and being able to easily and explicitly identify which symbol corresponds to which bit is really good.
its* memory model is
That is a very specific subset
Not that specific tbh, most newer native languages these days are compiled and memory safe (Rust, Swift, Go, Kotlin Native, etc)
Garbage collection is still allowed, and technically JIT languages are still compiled so it really isn’t that restrictive
Java, the language so good you compile it twice!
OCaml.
Sad I had to scroll to the end to see this.
Ocaml is brilliant and has the nicest type features. It’s almost like Haskell but more approachable imo.
I’ve recently been trying to learn OCaml and find it really nice. The major pain points are
- C-style separate compilation with manually created headers
- Small standard library
- No generic print function
- Hard to use external libraries
Is
Printf.printf
not a good generic print function? It’s even variadic!
As a Haskell programmer, “OCaml has the nicest type features” hurts just a little bit.
I sometimes teach a course in OCaml. The students who are very engaged inevitably ask my about Haskell, I encourage them to try it, and then they spend the rest of the semester wondering why the course is taught in OCaml. Bizarre how different that is from when colleagues in industry want to try Haskell.
What are your thoughts on this comparison? https://github.com/sidkshatriya/me/blob/master/007-My-Thoughts-on-OCaml-vs-Haskell-Rust-2023.md
Largely reasonable?
Haskell is not good for systems programming which sums up about 60-70% of that post. Laziness is lovely in theory but many industry uses of Haskell use stricthaskell for all or most of their code, so I certainly agree with that part too.
Their largest complaint about using Haskell for small non-systems programs seems to be the mental overhead induced by laziness. But for me, for small programs where performance isn’t a huge concern (think Advent of code or a script for daily life) laziness reduces my mental overhead. I think that author is just especially concerned about having a deep understanding of their programs’ performance because of their systems background. I worry about performance when it becomes relevant. Debugging Haskell performance issues is certainly harder than strict languages but still totally doable.
The lack of type classes or other form of ergonomic overloading in OCaml is easily the single “feature” most responsible for the language never taking off.
As someone who is not deep into type theory or functional programming, can you please explain why you mean by “ergonomic overloading”?
My understanding is that ocaml mitigates the need for type classes through its more advanced module system. So far I have been enjoying the use of OCaml modules, so I’m curious what exactly I’m missing out on, if any.
Thanks for taking the time to talk with me btw!
Coming from Haskell, OCaml always felt a bit strange to me. The double semicolons, the inconsistency in the standard library between curried and uncurried functions etc. Maybe I’m confusing it with Standard ML though, can’t remember.
I know double semicolons are a thing, but I’ve never had to use them. I forget what they’re for, but yeah it’s supposed to be an escape hatch for something that shouldn’t be happening iirc.
The curried snd uncurried functions… Maybe you are confusing with SML, because everything in ocaml is curried by default. Though admittedly the standard library could be more complete, but I personally am happy to use third party dependencies for less common things.
Hands down, Rust 🦀
Rust.
You mean… except Ada?
As others have said, Haskell and Rust are pretty great. A language that hasn’t been mentioned that I REALLY want to catch on, though, is Unison.
Tell us more about unison
Hard to describe in one phrase other than to say:
NixOS is to Linux as Unison is to Haskell
Content-addressing used in the context of programming languages in the service of solving the problem of distributed systems and their inability to share code across time and space.
Haskell has a content-addressed module that was perhaps influenced by Unison.
Here’s an excellent interview with one of the authors of Unison:
Rust
Python with MyPy.
(Almost any language can meet those criteria, with enough shenanigans.)
But that’s not compiled, not to binary at least.
But that’s not compiled, not to binary at least.
Well…sort of.
(Everything is weirder than it seems at first glance.)
Rust and Haskell (I think Haskell counts)