On Apr 9, 2012, at 12:27 PM, "Ángel González" <keis...@gmail.com> wrote:

> On 09/04/12 19:36, Luke Scott wrote:
>> On Apr 9, 2012, at 10:23 AM, Tom Boutell <t...@punkave.com> wrote:
>>> Also, your objection - that 'require_code' is confusing - would most
>>> likely be an issue for a handful of people who write autoloaders.
>>> Those clean PHP class files are almost always autoloaded.
>> Not really. Has nothing to do with auto loaders.
>>
>> require_code - A literal string? Is this eval?
>>
>> require_path - A directory?
>>
>> require_file - What kind of file?
> A php file, of course :)

I'm sorry but the word "file" is highly non descriptive. Remember to
consider newcomers to the language as well. Consider also the are
functions that already make use of this word such as: file,
file_get_contents, file_put_contents, readfile, etc...

>
>
>> You have to look at the keywords you're proposing and try to explain
>> then without prior knowledge or documentation.
> But if you come accross them you'd see something like:
> require_code "setup.php";
>
> Which is much more clear.

You also can't make the assumption that someone is going to learn this
from existing code.

>
>> These keywords are also ambiguous. require/include are well understood
>> for including code not templates. Not just for PHP.
> PHP has allowed to require HTML forever. Given it's php developers the main
> target, it is not a huge argument that they may get confused by
> require_file
> doing what require has always done.

And it's considered bad practice. A majority of PHP developers avoid
it. The only time they do this is for templates in very small
projects. For larger projects using PHP as a template  engine is
unmaintainable.

If you look at code on Github I'm sure you'll find most code starting
with <?php and that's it. Perhaps a handful stick ?> at the end... But
even fewer are going to break out of PHP just to print something.
Especially with nowdoc.

We aren't trying to be compatible with PHP 4. Most of what I have said
has been the case since PHP 5.1. At least 5.2 (which is no longer
supported).

Luke

>
> I admit require_code for a full HTML file* may be slightly odd, but
> require_file
> is completely aseptic about that.
>
>
> * Which should instead have been loaded with readfile()...
>
>
>> require_template on the other hand is clear and to the point. It's
>> hard to make the same kind of assumptions as you can with the other
>> keywords. And with those who know PHP it's readily apparent
>> require_template could mean short tags whereas the other leave you
>> scratching your head.
> Except  that you're breaking compatibility by designing it the opposite way.
> It may have been the perfect idea if we were designing PHP from scratch, but
> we're not. This is a 17 years old language.
>
>
>

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to