Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Haha, I was the one that wrote that example for the homepage. It was never meant to be a comment on the ideal data structures for different use cases. Rather it's just there to give developers a taste of the syntax: there's more semicolons and brackets than Python, less explicit typing than Java.

If you have an example of a better code sample for introducing language syntax, I'd love to see it so I can learn from it.




My point is that if you're going to iterate through the entire dictionary, there should be a way to get full key-value pairs, so you don't have to look up the value for each key. There's no need to change the entire example. Something like this:

        for ((name, job) in people) {
          trace('$name does $job for a living!');
        }




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: