9 ms·
> And you would only need Rust — while it excels in the lowest half of the stack, it’s pretty ok everywhere else too. A younger me, in search of a new language
by eminence32 4y ago
> And you would only need Rust — while it excels in the lowest half of the stack, it’s pretty ok everywhere else too.
A younger me, in search of a new language to learn, would have been turned off by something that is only "pretty ok"
But 20 years later, something that is "pretty ok" is exactly what I'm looking for. My experience has been that finding the perfect language (or perfect anything) is futile, and all I want is something that let's me solve my problems, don't get in my way, and don't really surprise me.
For a long while, python was my go-to "pretty ok" language, but eventually it stopped being "pretty ok" for me. Rust has now taken that spot.
- cglong 4y agoWhat soured Python for you?
- eminence32 4y agoOne too many TypeError at runtime. I became increasingly annoyed that nothing was catching my silly typos or other mistakes. These days there are some really good python static checkers available, but I'm not sure I really knew about them half a decade ago when I started to move away from Python
- kitkat_new 4y agocan you recommend a checker?
- leetrout 4y agoNot Op but once I experienced Go I started writing less Python by choice. Then TypeScript and hopefully soon more Rust. Typed Python 3 is just awkward enough to not make me enjoy it on small scripts and not accurate enough (yet) to be confident in it on large projects. I don't use numpy & friends so Python doesn't offer me much any more compared to newer typed languages once I go beyond a simple script.
- culi 4y agoYou should try out deno. TypeScript with zero set up. You can write a .ts file anywhere on your computer and run it with, e.g., `deno run hello-world.ts`. It's my new goto for quick scripts
- leetrout 4y agoYea! I actually wanted to teach using Deno back in 2019! It was a stretch topic for the last couple weeks of class in my syllabus but we were too far behind. Excited to see where it continues to go and we are writing more scripts in TS at work (without Deno, tho).
- prottog 4y ago> Then TypeScript Have you done any backend TS? I'm curious what the best practice there is, these days.
- leetrout 4y agoI am definitely not the person to ask there. I have been on a couple teams that used Node. Everyone was/is still using express and various ORMs / query builders. Knex and Prisma are what I saw. Lots of neat stuff with Zod and relatedly EdgeDB.
- raincole 4y agoI don't know if I just use Python "wrong" or something. When I worked as a TA, I've written a lot of untyped Python as Blender/Houdini plugins, and I think it worked pretty well for this purpose. But later I did some backend stuff, I tried to use typed Python and wrote safer code. Then the whole toolchain becomes so cluncky. MyPy, Pylinter, Flake8, etc. They're so slow, and their VSCode extensions are so weird to configure. And I never got the best practice to work with other untyped libraries. It's not that I don't know how to use typed language. Actually I do backend stuff faster in Rust than Python. It's probably just me or my VSCode acting up.
- kitkat_new 4y agoMy experience with Python recently: I have been working on a mediumish project (without tests or type hints) where I needed to add functionality including a bit rewiring. My main problems were: - I didn't know what data (types) were passed around when looking at parts of the code, so I had to look were the data structures were created, adapted and passed along to actually know more (or just debug it) - After changing parts of the code, I was 100% certain that I had to run it a dozen times to fix new bugs or things I had forgotten How it works with Rust: - I see the types in the function signature - I know the properties of 'classes' without scanning the whole code of the class - when it compiles, it works 90+% of the time, because the compiler tells me where I forgot something before, if the IDE hasn't already told me
- kazinator 4y ago> How it works with Rust ... You will be amazed to find that that's how it works with C, Pascal, Java ... Types being declared in function headers and checked is 1960's technology.
- johnny22 4y agoexcept the type system in C isn't that good.
- amluto 4y agoThat’s an understatement. If you see a function in a header like: char *func(char *in, size_t len); It’s anybody’s guess what the actual input type is, not to mention the ownership or lifetime of the output.
- kazinator 4y agoHN now supports backslash escapes for asterisks (which, unescaped, are markup notation for italics).
- iudqnolq 4y ago
- lmm 4y agoI left Python when I found Scala, and while a good type system was a big factor, the groundhog day of "Python dependency management is awful with 4 different tools none of which quite work right, but this new tool has fixed it, for real this time" every few years was the part that really made me despair.
- epage 4y agoNot OP but to me the ecosystem is too disjoint. To ship "production python", you need to figure out which of the "current" tools are to cobble together to build, test, and share your code. `cargo` combines poetry, ruff, pipx, sphinx, pytest, etc. You might expect this to be worse. In some cases, it is (e.g. pytest). The super power is in being able to get a project up and going immediately without wasting time on figuring out which tools to use, scaffolding them together, setting up a host for your documentation, etc. Then there comes the problem of distributing it where the target system has to have just the right version of Python.
- artursapek 4y agoit’s slow and there’s no helpful compiler
- ldjkfkdsjnv 4y agoPython doesnt really scale to large code bases, and refactoring is very hard.
- HervalFreire 4y agoNot if you use modern python. And by modern python I mean typed python. Heavily typed.
- aeyes 4y agoDo you have any real world experience? I'm working on a Python codebase which is almost 2 million lines of code with almost 100 developers and I haven't seen development speed slow down over the years. Of course you need to have a structure within this codebase or you'll bump into the typical problems of large codebases. Some languages force you to work this way, we do it by enforcing certain rules in the lower level framework code of the project. Also you need to keep pace, we are on the latest Python version and code is heavily typed. This project was started in the 2.7 days.
- HervalFreire 4y agoIn my opinion it's not pretty ok. It's actually superior to many other languages. I think for web stuff though the borrowing and move semantics is a bit of an overkill. Usually you don't need to thread or handle state in these areas (frameworks and databases handle it for you) so a GC works better here. But everything outside of that is superior to something like ruby, python or go when it comes to safety.
- vlovich123 4y agoI think if Rust could integrate a GC pointer elegantly into the ecosystem and put some of the knobs for running the GC the responsibility of user-space libs (ala pluggable GC), add in more optional type inference in places, and make it easy to refactor code to remove the GC, then it could become quite interesting for higher level glue code. As is, it’s not quite as good as TypeScript I think
- HervalFreire 4y agoThere is a reference counting GC in rust. It's just not default and you have to be explicit about invoking it. It's similar to shared pointers in C++. See Arc. For something like python the heap allocation or stack allocation is handled behind the scenes so the entire concept is abstracted away from you.
- vlovich123 4y agoI meant a tracing GC like https://docs.rs/gc/latest/gc/ https://docs.rs/gc/latest/gc/. Arc still requires you to reason about ownership as does this GC. I think single threaded async w/ easy no copy message passing is more akin to what most people want when thinking about concurrency (eg Go channels) and actually happens to perform exceedingly well when it’s done up and down the stack (eg io_uring). In such a model you don’t even need to worry about ownership so much because you can’t Send anything except for things that need to be so there’s not a lot of value in many of the protections Rust tries to put in place.
- platinumrad 4y ago
- Existenceblinks 4y agoassembly/c/c++/perl/ruby/elixir/elm/js are "pretty ok" to me no matter how long I had written with. python is absolutely not ok to me .. always think "really?" I want to write it in another way, but it can't be.
- cameronh90 4y agoIt's not popular among the crowd here, but my favourite "pretty ok" language is C#. It's not really the best at anything, but it's pretty good for most use cases. That being said, because there's no one perfect language, it's handy to have a few in your arsenal. As much as I like C#, I'd still reach for Python for any data or ML type use cases.
- imwithstoopid 4y agoOr Go, whose guiding principle seems to be "Pretty OK"
- shakow 4y agoGo guiding principle is rather “the lowest common denominator”.
- ostenning 4y agoC# is, in my opinion, a fantastic language. I haven’t used it in a long time, but the “ergonomics” were really nice. The downside of C# was microsoft, but maybe thats changed now? I know they made a lot of effort to make the .NET framework more cross platform.
- throwawaymaths 4y agoThe downside of c# is it's easy until you run into the 80 flavors of async it has.
- schemescape 4y agoWhat is there besides Task<T>?
- legulere 4y agoFirst there was APM https://learn.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/asynchronous-programming-model-apm https://learn.microsoft.com/en-us/dotnet/standard/asynchrono... then there came TPL (using Task but without async await but ContinueWith) and finally async await with some later refinements like ValueTask. Generally you just use async await nowadays with maybe the complication of when to use Task or ValueTask