4 ms·
Everything is a balance. Can you have the power of Python in a Wirth-like language? Pascal compiles fast into executables that are easy to distribute. Python is
by 7thaccount 3y ago
Everything is a balance. Can you have the power of Python in a Wirth-like language? Pascal compiles fast into executables that are easy to distribute. Python is extremely flexible and easy to use for a wide array of problems, but is a packaging nightmare. Languages like C are blazing fast and easy to distribute, but require a lot of code to do what I can do in a few lines of Python.
I haven't used Swift, but hear it may be a bit of a compromise in that it compiles (albeit not in a single pass I don't think) and using it is not that much more verbose than Python. I know Nim and Crystal are similar attempts, but Nim doesn't seem as easy to use to me.
- archargelod 3y ago> ... but Nim doesn't seem as easy to use to me. Hm... Can you elaborate why? For me, Nim is the easiest language to work with. It really feels like Python with static typing. This one is probably a hot take, but I believe that static typing is vastly superior and easier to think about than dynamic typing. In languages like Python or JS, Lua, etc. it's not like they don't have types, types are merely hidden, you still should be aware of types. They just move responsibilty for handling type errors from compiler to the programmer. Or maybe because Nim is extensible? I know that big point of Nim is macros, and macros in general are hard. But in my experience I've never felt that I need to write one, when using Nim.
- mjburgess 3y agoThe jai, zig, etc. approach is compile-time metaprogramming; make the compiler available to program, make the build system plugging into the compiler. Then I think you can do it. The compile-time is "a Wirth" and the runtime is "a Wirth". You get 95% the benefits of a python, since 95% of the dynamics you want are actually just static transformations of the program.
- 7thaccount 3y agoI don't see how you can get 95% of the benefits of Python by programming in Zig. When I looked into Zig, it was like coding in C. Not as many built-in data structures and you have to manually manage memory and all that. Zig seems like an attempt for a better C.
- mjburgess 3y agofor most applications you dont need gc, you can just have a one-off temporary allocator. you only really need the malloc model, or the gc model, of memory management for long running apps for python-style apps, theyre all die quickly