Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Learn JavaScript the Hard Way
8 points by mconintet on July 24, 2019 | hide | past | favorite | 4 comments
Learn JavaScript and Rust by writing a naive JavaScript engine in Rust from scratch

https://github.com/hsiaosiyuan0/naive




Keep in mind that title is also the title of a book by Zed Shaw:

https://learncodethehardway.org/javascript/


I have a bit of an off-topic question for anybody who writes Rust.

I'm more familiar with web development and higher level languages, but I've always been interested in Rust. While I know a bit of C/C++, I'm far from an expert. One of the things that turns me off from those languages are the frequent use of really short or cryptic variable/function names.

I'm looking at this codebase, specifically https://github.com/hsiaosiyuan0/naive/blob/master/src/lib/to..., and I see stuff like `let (s, kv, vk, be) = gen_map!`. I have no clue what those variables would be unless I dug around the rest of the file.

Is this sort of variable/method naming convention common in the Rust world? I am not criticizing the author or the language here, merely just curious what I should expect if I dipped my toes into Rust.


It depends; Rust is more concise than many languages, but it’s not always that concise. They are in this case because they’re only used once, below the match statement, and are abbreviated forms of the things they’re being assigned to.

Type variables and lifetime names are often only one letter, though.


Might this be better named "rebuilding javascript" in the style of https://rebuilding-rails.com/?




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: