[thelist] Coning conventions, pet peeves

Nadeem Hosenbokus nadeem at nadeemh.com
Fri Apr 29 06:50:03 CDT 2016


Isn't there something about Yoda Conditions catching NULL values instead of transforming them into FALSE?

Effectively the difference between '==' and '===' (in PHP). It's a little pointless if there's a specific operator to do the same job but maybe some languages don't have a specific operator?

My general attitude when I come across something that looks silly is to assume that the person who wrote it does actually know what they're doing and did this thing for a specific reason that I have yet to discover.

Whilst we're on the subject of code formatting, apparently a lot of people hate 'code' like this:

ul{ display: block; margin: 0 0 30px; border: solid 1px #cccccc; }
     ul li{ display: block; border-bottom: solid 1px #cccccc; }
         ul li:last-child{ border-bottom: none; }
         ul li a{ display: block; padding 10px; color: #333333; text-decoration: none; }
              ul li a:hover{ background-color: #cccccc; }

I find that it makes understanding the hierarchy of my styles much easier to understand (and I wouldn't change it) but I recently read that this style of writing is abhorrent. Is it?

Thanks,

Nadeem Hosenbokus
(230) 5766 9169
www.nadeemh.com
http://mu.linkedin.com/in/nadeemhosenbokus


-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Volkan Özçelik
Sent: 28 April 2016 23:20
To: thelist at lists.evolt.org
Subject: Re: [thelist] Coning conventions, pet peeves

> By putting the comparison the other way around - making sure that the
thing to the left of the operator is not an lvalue - you make it harder to make this mistake.

Yup that’s the reason.

Rest assured, Arabs don’t read code right to left :)

You can see [1] for a detailed discussion on the subject matter.

[1]: "Yoda Conditions" http://www.wikiwand.com/en/Yoda_conditions

HTH,

Volkan.

On Thu, Apr 28, 2016 at 11:33 AM Jason Handby <jason.handby at corestar.co.uk>
wrote:

> > By putting the comparison
> > the other way around - making sure that the thing to the left of the
> operator
> > is not an lvalue - you make it harder to make this mistake.
>
> ("lvalue" just means something that can legitimately go on the left of 
> an assignment operator.)
>
> Jason
>
> --
>
> * * Please support the community that supports you.  * * 
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester and 
> archives of thelist go to: http://lists.evolt.org Workers of the Web, 
> evolt !
>
-- 

* * Please support the community that supports you.  * * http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 



More information about the thelist mailing list