Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59538 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67880 invoked from network); 9 Apr 2012 19:57:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Apr 2012 19:57:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=luke@cywh.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=luke@cywh.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cywh.com from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: luke@cywh.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:52148] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/47-34074-22F338F4 for ; Mon, 09 Apr 2012 15:57:23 -0400 Received: by vbjk13 with SMTP id k13so2949389vbj.29 for ; Mon, 09 Apr 2012 12:57:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=references:from:in-reply-to:mime-version:date:message-id:subject:to :cc:content-type:content-transfer-encoding:x-gm-message-state; bh=/6+cvv0nowVTW/aSHWGVmE24kGmh8IzBj8ZX1uvpmnQ=; b=VIty4feK2NMeagv/o1k8nDgowZ475IRWtfXAjRrHP+MlXG/fs6igC+G6Kw5l4AmoIi hLkw7l8oMiT8v3sJJrAJAxVmiwIIl8cEYrLau2Kb4L3Xcph31MHdSpidcVwQNwzghb/e k9dx/y33YUGtQYJjNyk6g1zrrEBwoFVLHR57E2sn9Kg8bZo7noFcKJpwc2nXr46CK41B +xdYA6xyLGeJ0FCKtHGbjx77ZVbmalFXBKz6clMn584wnXVSbxC6ipFNO9UvF553BSI7 pGzMJ4+YNe12dWNQo7UZ3M3pmiktmMy7dK/aZR+tmM+QeIw1sV47fFBzBmEsE252Ls0w nMZg== Received: by 10.220.141.84 with SMTP id l20mr4288362vcu.31.1334001440239; Mon, 09 Apr 2012 12:57:20 -0700 (PDT) References: <-5877502932356715576@unknownmsgid> <-3647345967307864634@unknownmsgid> <-1399915171627175127@unknownmsgid> <4F83394B.90602@gmail.com> In-Reply-To: <4F83394B.90602@gmail.com> Mime-Version: 1.0 (1.0) Date: Mon, 9 Apr 2012 12:57:18 -0700 Message-ID: <4642945982671920423@unknownmsgid> To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: Tom Boutell , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnhmkgGvHM1daLTaXqx4ev7Olr/uEt2sSdRb2sja8xQD0ZALIiLpb93cqPhaXUcuOBTc6B/ Subject: Re: [PHP-DEV] RFC: source files without opening tag From: luke@cywh.com (Luke Scott) On Apr 9, 2012, at 12:27 PM, "=C1ngel Gonz=E1lez" wrote= : > On 09/04/12 19:36, Luke Scott wrote: >> On Apr 9, 2012, at 10:23 AM, Tom Boutell 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 ma= in > 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 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 w= ay. > 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. > > >