Earlier quoted context omitted.
> A type is a contract, not a hint! In Python it is a hint.
Exactly. That was their worst mistake ever
SPy: An interpreter and compiler for a fast statically typed variant of Python
91–100 of 133 posts
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#92It's weird, but the pain of moving to a whole new language seems less than the pain of using one of these language subsets. I guess it might be because of "loss aversion": we dislike losing something we have more the value we put on gaining it. In a new language each newly added feature is a gain, but in a language subset you're always encountering things you would have in the full language. So no matter how good the…
One of the standard architectures for complex applications is to put together a scripting language and an systems programming language. You can either look at the scripting language as primary with the systems language used for performance or hardware interfacing or you can look at the systems language being primary and the scripting being used around the edges. The model of having a closely related scripting and sys…
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#93While obviously this would need CPython to SPy `import` support for it to displace CPython for me, it seems like you can `import` SPy to CPython, which makes it an attractive solution for implementing fast libraries where Rust is perhaps too heavy duty.
# - the unsafe module allows C-level direct memory access to pointers and unsafe arrays
# - @struct maps directly to C structs
# - most users will never have to deal with this directly: using the unsafe` module is the equivalent of writing C extensions or using Cython
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#94Earlier quoted context omitted.
You can have that today with Nim.
There don't seem to be great web frameworks like Flask, Django, or FastAPI for Nim.
If either/both are not "great enough" in some particulars you want, why not raise a github issue? (Or even better look into adding said particulars yourself? This is really the main way Python grew its ecosystem.)
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#95Earlier quoted context omitted.
There is a compiler detailed in the page on the link; > 3. We have a compiler for deployment and performance. The interpreter and the compiler are guaranteed to produce the exact same results at runtime.
Where is it? Would love to compare the approach to py2many.
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#96Earlier quoted context omitted.
One of the standard architectures for complex applications is to put together a scripting language and an systems programming language. You can either look at the scripting language as primary with the systems language used for performance or hardware interfacing or you can look at the systems language being primary and the scripting being used around the edges. The model of having a closely related scripting and sys…
Yes, there are quite many real-world cases of this architecure. But, wouldn't it be better it the same language (more or less) can be used for both? I don't think such a language exists currently, but I think it would be a nice goal.
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#97The examples in the playground are neat but I don’t see any of the Python bread and butter usage. I see C with Python syntax.
I’d like to see Python syntax solving a problem in a pythonic way, albeit with type annotations. And then I’d like to see the compiled version run 30x-100x faster. Is that ultimately the promise of this project?
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#98Earlier quoted context omitted.
Yes, there are quite many real-world cases of this architecure. But, wouldn't it be better it the same language (more or less) can be used for both? I don't think such a language exists currently, but I think it would be a nice goal.
Oxcaml, of course.
In my view, a "better" language would be a simple language as concise as Python, but fully typed (via type inference); memory safe, but without the need of tracing GC. I think memory management should be a mix of Swift and Rust (that is, a mix of reference counting and single ownership with borrowing, where need for speed).
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#99It's weird, but the pain of moving to a whole new language seems less than the pain of using one of these language subsets. I guess it might be because of "loss aversion": we dislike losing something we have more the value we put on gaining it. In a new language each newly added feature is a gain, but in a language subset you're always encountering things you would have in the full language. So no matter how good the…
The author seems to speak to that here: > SPy does something different: on one hand, it removes the dynamic features which make Python "slow", but on the other hand it introduces new features which make it possible to implement and use the same pythonic patterns which we like. The author seems unusually focused on explaining his new way, which may help it feel more like a new language with a coherent philosophy and u…
Re: SPy: An interpreter and compiler for a fast statically typed variant of Python
#100I like the idea of a compiled language that takes the look and ethos of Python (or at least the "looks like pseudocode, but runs"-ethos) I don't think the article gives much of an impression on how SPy is on that front.
I believe that Python is as popular and widely used as it is because it's old enough to have an expansive ecosystem of libraries. It's easy enough to implement one in pure Python and possible to optimize it later (Pydantic is a great recent-ish example, switching to a Rust core for 2.0). That same combination of Python + (choose a compiled language) makes it quite difficult for any new language to tap into the main s…
There is a factor of 3x difference in dev speed between the two typing systems.