On Saturday, October 5, 2024 at 7:45:04 AM UTC-5 Edward K. Ream wrote:

> Lately, I've been studying Rust using my (tbo-in-rust 
<https://github.com/edreamleo/ekr-tbo-in-rust>) project. This toy project 
transliterates Leo's token-based beautifier (leoTokens.py) into Rust.

The updated readme file <https://github.com/edreamleo/ekr-tbo-in-rust> 
discusses the status of the tbo-in-rust project. The project is at a good 
stopping point, but I might press on a bit more.

Here are a few notes:


*Aha: In structs, use pointers, not objects where possible.*

This pattern requires lifetime annotations. Happily, the compiler usually 
suggests the correct hieroglyphics! This pattern *usually *keeps the borrow 
checker happy.

*Optional data is a nightmare in function/method signatures.*

 My workaround is to use dummy entries in data structures to avoid using 
"None".

*It's shocking how much cruft Rust has.*

After a few days I lost sight of all the blah-blah-blah that Rust requires. 
When I started to transliterate another piece of Python code, it was 
*shocking* how much more clearly Python expresses ideas.

*Summary*

- As reported earlier, the tbo-in-rust project will never be fast enough to 
be useful as production code.
- Using the patterns reported here, programming in Rust looks and feels 
much like programming in C.
- I'm glad to have learned the basics of Rust, but I have no interest in 
becoming a Rust programmer.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b135570b-2729-4220-88a1-2249a5ea5b9en%40googlegroups.com.

Reply via email to