CommunityNews

CommunityNews

Avoid Yoda conditions in Perl you should

Avoid Yoda conditions in Perl you should—The Phoenix Trap.
Assign not when mean to compare you do. Help you warnings and strictures can.

Read in full here:

https://phoenixtrap.com/2021/12/28/avoid-yoda-conditions-in-perl-you-should/

This thread was posted by one of our members via one of our news source trackers.

Most Liked

davearonson

davearonson

Not just Perl; this used to be fairly common in C. Eventually we developed the convention that if you really did mean to assign and compare the results of that, as in if (c = getc()) you would wrap it in an extra set of parentheses, like if ((c = getc())). Then, the compiler would use that as a “yes I really meant to do that” signal.

On the other claw, Perl never was exactly famous for readability…

Where Next?

Popular Backend topics Top

New
New
New
First poster: KnowledgeIsPower
Rocket is a web framework written in Rust. It provides a concise API and is opinionated and feature-rich beyond what you would typically ...
New
CommunityNews
Algebraic effects and handlers provide a modular abstraction for expressing effectful computation, allowing the programmer to separate th...
New
CommunityNews
Avoid Yoda conditions in Perl you should—The Phoenix Trap. Assign not when mean to compare you do. Help you warnings and strictures can.
New
CommunityNews
GitHub - let-def/hotcaml: Hotcaml: an interpreter with watching and reloading. Hotcaml: an interpreter with watching and reloading - Git...
New
First poster: bot
To build a web application you need to make architecture decisions across a range of topics. The beauty of Ruby on Rails or Django is tha...
New
First poster: bot
GitHub - WhatsApp/waraft: An Erlang implementation of RAFT from WhatsApp. An Erlang implementation of RAFT from WhatsApp. Contribute to ...
New
First poster: bot
GitHub - codic12/worm: A dynamic, tag-based window manager written in Nim. A dynamic, tag-based window manager written in Nim - GitHub -...
New

Other popular topics Top

PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
PragmaticBookshelf
Author Spotlight: Sophie DeBenedetto @SophieDeBenedetto The days of the traditional request-response web application are long gone, b...
New
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New