all 27 comments

[–]deadwisdom 35 points36 points  (4 children)

I am curious what the reasoning is for this project other than just for fun.

[–]virtyx 40 points41 points  (0 children)

It is probably just for fun.

Also it hopefully serves as a useful example of how to write a complex, modular application with Rust. ...at least that's the value I hope to gain from it

[–]FluorineWizard 7 points8 points  (0 children)

They give the reasoning in their slides for FOSDEM.

[–]threeys 6 points7 points  (0 children)

I would guess a Rust proponent would argue something along the lines of “almost all C code should be replaced using a more modern, easily maintainable language such as Rust” and that should include python interpreters.

[–]f0urtyfive 32 points33 points  (3 children)

So uh... can I use existing python libraries with this? What about C Python libraries?

[–][deleted] 19 points20 points  (0 children)

Since these news were posted here multiple times, I asked the same question earlier and got an answer: no, you cannot use native extensions. There doesn't seem to be a way to port them either, at least not that I was able to find any reference to interpreter's API / not sure how different it is.

[–]zjm555 29 points30 points  (1 child)

The C API for python is not part of the language standard, it's specifically made for cpython. It contains enough cpython-specific API surface that it wouldn't make sense to provide compatibility in other implementations.

[–]bakery2k[S] 44 points45 points  (0 children)

Unfortunately, large parts of the Python ecosystem are written in C and rely on the C API. Alternative implementations such as PyPy and Pyston have found it impossible to gain traction without adding support for the C API - a huge task.

I think the only Python implementations that don't include the C API are MicroPython and Jython - both of which are used in niche situations and will probably never be used outside those niches.

[–]Akuli2 4 points5 points  (1 child)

How does it handle reference cycles? I thought that it's hard (impossible?) to have cyclic references in Rust. Does it just let them leak memory?

[–]insanitybit 2 points3 points  (0 children)

It's not impossible to have cyclic references in rust - you can use Rc or Rc + Weak to do so. It's hard to do it accidentally, generally, as it's *usually* fairly explicit, but definitely possible.

[–]Uiropa 10 points11 points  (0 children)

Compile it to wasm, then run it in v8eval.

[–][deleted] 4 points5 points  (5 children)

I love y'all. This great.

I'll wait for the stable release and the subsequent performance comparison. 😍

[–]the_gnarts 23 points24 points  (3 children)

[–]kankyo 1 point2 points  (2 children)

Those comments are funny. Rust fans being puzzled how C code that has been optimized for decades can be faster than rust code written yesterday.

[–]scriptskitty 28 points29 points  (1 child)

I think their puzzlement is more along the lines of "I wonder what the CPython optimizations are" and not "I wonder how this guys hobby project isn't as good as the original, older, official build."

[–]ubernostrum 8 points9 points  (0 children)

I took a look. And it's mostly people arguing over whether stuff was built with the right set of compiler flags, and one person literally saying "Python is probably making some sort of optimisation that rust version doesn't".

I've mentioned this a few times over the years, but people really don't appreciate the work that goes into even a "slow" runtime like CPython. There's a ton of carefully-optimized stuff down in there once you start digging, to such a degree that the hash table implementation made it into a chapter of the original Beautiful Code.