4 ms·
Python, but with static typing and compiled to native code. I love Python's syntax. It's usage of whitespace forces people to have some semblance of proper fo
by Sohcahtoa82 4y ago
Python, but with static typing and compiled to native code.
I love Python's syntax. It's usage of whitespace forces people to have some semblance of proper formatting. Overall, I find Python code extremely easy to read.
But my god is it slow, and I've always assumed a lot of its slowness is due to being interpreted and the duck typing.
- aserafini 4y agoSounds like Nim could be what you’re looking for? https://nim-lang.org/ https://nim-lang.org/
- Sohcahtoa82 4y agoMaybe. I might have to try it out some day.
- bheadmaster 4y agoI've worked with Python for years, and Go (golang) turned out to be everything I wanted Python to be. Admittedly, Go doesn't have enforced whitespace, but it has standardized code format, enforced by the `gofmt` tool, so in 99% of cases it looks as good as Python. The syntax is somewhat similar - there is a lot of type inference and duck typing, yet the type system is still static (which removes a majority of type errors), with opt-in dynamic typing through `interface{}` (the empty interface, which is implicitly implemented by every type) and type switches. Go is compiled to native code, and can be statically linked, making it perfect for containerization, since you don't need any dependencies whatsoever - just copy the executable into a scratch container and be done with it. It's also very fast, and incorporates an async-by-default runtime which is scalable to an arbitrary number of CPU cores out of the box. Imagine asyncio, but multithreaded, and without the async/await keyword littering - that's Go runtime. My favorite feature of all - the `select` keyword, which waits for a fixed set of channels (similar to queues, but lightweight), and receives/sends a value from/to the first channel that has another goroutine (similar to thread, but lightweight) sending/receiving a value to/from it. It's a very useful feature for building event-driven systems. Sorry for the sales pitch. I just really like Go :)
- Sohcahtoa82 4y agoGo also has something other language lack... An adorable mascot. ;-)
- bheadmaster 4y agoTrue. I love that lil guy like you wouldn't believe :)
- adastra22 4y agoWhat Linux had but MINIX lacked.
- BerislavLopac 4y ago> I've always assumed a lot of its slowness is due to being interpreted and the duck typing Being interpreted definitely, even though there are some rarely-used methods that can improve that. Additionally, there are more than one implementations of Python, and pypy is much faster than the standard CPython. As for duck typing, why would that make a language slower exactly?
- Sohcahtoa82 4y ago> As for duck typing, why would that make a language slower exactly? I assumed it would result in basically every operation to require multiple lookups to figure out how types would interact at runtime. Like a simple "foo.bar(biz + baz)" would have to check the types of biz and baz, figure out how to add them, then look up the foo object and make sure it has a function named baz, and then call it. I assumed all these lookups and verifications would add significant overhead.