Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54503 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4817 invoked from network); 11 Aug 2011 05:34:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2011 05:34:44 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.215.42 mail-ew0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:53004] helo=mail-ew0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/E0-00852-1F9634E4 for ; Thu, 11 Aug 2011 01:34:42 -0400 Received: by ewy2 with SMTP id 2so778456ewy.29 for ; Wed, 10 Aug 2011 22:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9snNlueu1DDQsEJEsTyh5ctCoyYArh294f8SG+FgzVY=; b=qAW+eBF3y0Yve68zMsYrd1LjE57Lo/ihA/PnfYbL8CNigEyFjqR6APsKnAKdKVFBYZ SZREjTxdoWAReIl5iDeh2CF5zULrK8zrV84Y1OVCsm9Xd5pXN4y6aQPfwfOBD4WXnjpY Agjgu3+K/GlLWv7Uyx93cydPiv0WSumgPHQkQ= MIME-Version: 1.0 Received: by 10.14.100.70 with SMTP id y46mr2692945eef.67.1313040876807; Wed, 10 Aug 2011 22:34:36 -0700 (PDT) Received: by 10.14.186.129 with HTTP; Wed, 10 Aug 2011 22:34:36 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Aug 2011 07:34:36 +0200 Message-ID: To: Gwynne Raskind Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] [RFC] Line markers in PHP From: nikita.ppv@googlemail.com (Nikita Popov) In my eyes this change isn't necessary and if it is, not with this syntax. First the syntax: PHP is not C, we do not have preprocessing instructions using hash notation. Such a syntax seems unfamiliar in PHP. Additionally # is already used for single line comments so there's actually is no backwards compatability: Old code that accidentally was of your proposed form would trigger a line marker, potentially causing much confusion when debugging. If we really do need such a feature it should follow PHP's declare syntax: declare(line=17, file='hi'); // or declare(line=5) { // ... } Now concerning your use cases: It is fairly easy to rewrite PHP errors. One of the examples you give are Smarty templates. Twig (another template engine), already does line number rewrites by inserting `// line ...` comments into the template and extracting that information using the tokenizer. (https://github.com/fabpot/Twig/blob/master/lib/Twig/Error.php#L147) It's not terribly complicated. And this is the most complex case, where line number distribution is not just off-by-n, but really requires line-hints in the source. For the PHPT tests a simple addition of the number of lines before the actual test will suffice. Even no tokenizer needed. (Sorry, forgot to send to list)