Discussion

Ask HN: Your favorite syntactic sugar from any language?

Most programming languages I've encountered, no matter how otherwise unappealing, have at least one syntactic feature that makes them really pleasurable for at least some type of task.

Some things I miss when I don't have them are:

* "=~" for regex matching (as in Perl and Ruby)

* "{foo:['bar','baz']}" for quick data structures (as in JavaScript)

* "for f in *; do echo $f; done" for looping over a 'glob' of files (as in Bash)

What's your favorite bit of sugar?

32 points davegauer 8 years ago 85 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton