Re: The "goto" discussion on the Internals List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, June 9, 2005 6:49 am, Jochem Maas said:
> Richard Lynch wrote:
>> And, for the record, *I* sure as hell don't want to see a GoTo in PHP.
>
> whats your take on ifsetor()?, personally I would like to see it. I think
> its a great way to teach newbies about checking vars before use (if
> nothing
> else)

This probably doesn't belong on this list, but I was asked here, so I'll
answer here. [Plus I'm not on the internals list.]  Re-direct followups
off-list or back to -internals or ...

I don't think ifsetor is going to encourage newbies to check variables
before use.

In fact, I think it's just going to confuse newbies with one more extra
way to do the same thing.

Only turning E_ALL on by default (which I asked for in PHP 4.0 and PHP 5.0
and will ask again for PHP 6.0 and 7.0 and 8.0 ...) will actually educate
newbies that they are doing something fundamentaly "wrong" in their
Programming to use variables they haven't initialized.
Spare the rod, spoil the child.
Spare the E_NOTICE, spoil the newbie.

There's currently NOTHING other than 10,000 pages of docs to tell a newbie
they NEED to check vars.

The quickie examples everybody rattles off don't check vars.

The MANUAL doesn't even consistently use good programming practices in its
examples -- though it gets better over time, mostly.

Then people want to "simplify" the examples down to just the
function/feature in question, and we go back to Bad Code.

ifsetor doesn't really seem to add much value to me.

$foo $: $default;
$foo = ifsetor($default);
$foo = isset($foo) ? $foo : $default;

What?  15 to 20 characters, depending on the ifsetor syntax?

I'll pass.

I don't think ifsetor adds enough value to the language to be worth the
confusion of having a second way to do the same thing in ~20 more
characters, personally.

[shrug]

If it gets added, I'll probably never even bother to use it.  I've been
typing the isset() ? : construct for so many years, that I'm not gonna
switch for the sake of a few less keystrokes.  Sorry.

I certainly don't want to be the one answering the 10,000 emails to this
list:

Which is better? isset() ? : or ifsetor?

Which one is faster?

Why are there two ways to do this?

What's this ifsetor thing? / What's this isset() ? : thing?

And then the arguments between the experts (self included) over which one
is "better" and why.

Cuz I'll tell you right here, right now, that's one consequence of this
proposed change.  10,000 more emails to php-general in the next year or
two, just about 'ifsetor'.

My vote, if anybody cares to count it:

-1

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux