Carlos Ceron
ceronman.com · Personal blog · on HN since 2012
Carlos Ceron, a software developer, writes about Rust, Python, and programming language design, including building an interpreter in Rust.
What HN saysHN commenters point to his Lox interpreter in Rust write-up, with one saying they hit the same issues and ended with a similar implementation.
19HN people shared it
9linked it in comments
13stories submitted
454story points
2 years agolast shared
2012people per year2026
Most-shared posts
- 1My experience crafting an interpreter with Rust11 people · 92 points · first shared 2021 · 5 comments on HN
- 2CoffeeScript: less typing, bad readability4 people · 349 points · first shared 2012 · 218 comments on HN
- 3Is Rust a Functional Language in Disguise?3 people · 3 points · first shared 2020 · discussion on HN
- 4A powerful unused feature of Python: function annotations.2 people · 7 points · first shared 2013 · discussion on HN
- 5Types and self-documenting code in Rust1 people · 2 points · first shared 2024 · discussion on HN
- 6Beyond Javascript part 2: Dart and Typescript1 people · 1 points · first shared 2012 · discussion on HN
What HN people wrote when they linked it
jdnier · 2013-11-09
> Most “scripting” languages don't support annotations for checking parameters and return values
PEP 3107 introduced function annotations to Python 3. The following syntax is valid:
>>> def square(n: int) -> int:
... return n * n
...
>>> square(3)
9
Nothing is done with annotations by default. Here's an article discussing this "unused feature": http://ceronman.com/2013/03/12/a-powerful-unused-feature-of-python-fun…
elcritch · 2023-03-27
> That said, it is still the case that most programs aren't penalized by GC much. But people do still work on operating systems, games, databases, video editing tools and such where getting great performance is really important.
This statement simply isn't true though, at least in the general sense. Sure, for old school atomic RC and compilers that didn't do RC elision etc it might've been true. But we can and have made smarter compilers, just like Rust has gotten smart about life times.
Like @netbioserror I use Nim, but for embedded and real-time stuff. There is a minimal overhead (one machine word per allocation), but using Nim's ARC "memory management system" gives me results comparable to Zig or Rust though with much less work. Technically ARC without the cycle collector isn't a GC.
There's no reason D and other languages with "memory management" couldn't do similar RC based systems. As the compilers get smarter it approaches the same result as Rust's manual lifetime analysis. In many cases compilers can be smarter than human programmers about memory.
Even then, there's occasions where in Nim one can and will reach for manual memory allocations. It's easy to do when wanted.
> 2. There will be things the language won't let you do, because it is garbage collected
There will be things that systems like Rust's lifetimes makes harder / less performant as well: https://ceronman.com/2021/07/22/my-experience-crafting-an-interpreter-…
> 3. There will be extra FFI…
ceronman · 2024-07-31
Nice article. A couple of years ago I also implemented Lox in Rust. And I faced the exact same issues that the author describes here, and I also ended up with a very similar implementation.
I also wrote a post about it: https://ceronman.com/2021/07/22/my-experience-crafting-an-interpreter-…
I ended up having two implementations: One in purely safe Rust and another one with unsafe.
Note that if you're interesting in the "object manager" approach mentioned, I did that in my safe implementation, you can take a look at https://github.com/ceronman/loxido
chubot · 2021-08-04
The safety guarantees don't come for free. There are tradeoffs. That should be clear from the fact that Rust as a language is still changing, i.e. relaxing ownership rules and adding new mechanisms to the type system. If there were no problems, then there would be no language changes necessary.
Examples of people writing Rust code and hitting problems of expressiveness and performance:
My experience crafting an interpreter with Rust https://ceronman.com/2021/07/22/my-experience-crafting-an-interpreter-… (I'd be interested in experiences from others who have implemented a GC'd language runtime in Rust)
Also see Why I rewrote my Rust keyboard firmware in Zig: consistency, mastery, and fun
https://news.ycombinator.com/item?id=26374268
You can argue about how much the tradeoffs matter, which is heavily domain specific. But you can't argue that the tradeoffs don't exist.
divs1210 · 2021-07-30
You might find this blog post interesting:
https://ceronman.com/2021/07/22/my-experience-crafting-an-interpreter-…
v8dev123 · 2021-04-18
I don't spam C++ and I comment on C++.
There is no fight. There is made-up flame-war. Every war happen at HN and Reddit's Echochamber not at Real World.
Every languages has headaches. You won't find a perfect language ever.
You can't do serious Rust if you don't understand functional aspects.
I know C++, Haskell and Rust. Like many says Rust is a functional language disguised as imperative. There were case studies on Rust where a one with Haskell background more like to learn it faster than a one with C++ background.
The Rust book don't show you the functional parts at beginning to build your intuition but once you drive deeper you will realize what I meant.
https://ceronman.com/2020/09/17/is-rust-a-functional-language-in-disgu…
colin_jack · 2015-02-05
On the multiple ways, I was sure I read a post that documented them all and had me nodding along but can't find it, this one seems good though [1].
[1]
http://ceronman.com/2012/09/17/coffeescript-less-typing-bad-readabilit…
alongub · 2014-11-17
Exactly. Syntax style is usually a matter of personal opinion. "Alien syntax" wasn't very objective and I should probably remove it from the website.
However, ambiguous syntax is a huge problem of CoffeeScript. Read more here: http://ceronman.com/2012/09/17/coffeescript-less-typing-bad-readabilit…
crazygringo · 2013-07-28
Well the original post is one example, obviously.
But, lots of examples below, all from the first few Google results of "coffeescript ambiguity":
http://ruoyusun.com/2013/03/17/my-take-on-coffeescript.html [section "full of surprises"]
http://ceronman.com/2012/09/17/coffeescript-less-typing-bad-readabilit…
http://johnbender.us/2012/11/27/math-envy-and-coffeescripts-foibles/ [this is a more formal analysis]