Hacker News new | past | comments | ask | show | jobs | submit login

Perl also had that delayed syntax check style as an option and I HATED IT.

THING if logical condition

Filter First is far better self-documentation: if condition THING




It works well in cases where you have an operation that consists of a certain sequence of statements, where one of the statements has to be omitted in a particular atypical situation. Instead of having interrupt the sequence with an if, you just tag the particular statement with the omitting condition at the end. That’s also when unless tends to be intuitive, because it suggests an atypical condition.


That is usually where I used it too.

When I started writing these as pipeline execution. Then I’ll use a maybe?() instead if the conditional does not need to depend on the result of a previous operation.


That's a matter of what fits better with the structure of how you think internally, and not necessarily that there is an objectively better way for self-documentation.

For example, I can totally see how imperative-first would mess up people with neurodivergant brains.

Tangent -- Ruby takes a lot of inspiration from Perl.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: