Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51126 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67306 invoked from network); 22 Dec 2010 22:28:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2010 22:28:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=gwynne@darkrainfall.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=gwynne@darkrainfall.org; sender-id=unknown; domainkeys=bad (key type) Received-SPF: error (pb1.pair.com: domain darkrainfall.org from 208.97.132.119 cause and error) DomainKey-Status: bad (key type) X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: gwynne@darkrainfall.org X-Host-Fingerprint: 208.97.132.119 caiajhbdcbbj.dreamhost.com Linux 2.6 Received: from [208.97.132.119] ([208.97.132.119:53511] helo=homiemail-a6.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/21-59570-E7B721D4 for ; Wed, 22 Dec 2010 17:28:15 -0500 Received: from homiemail-a6.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a6.g.dreamhost.com (Postfix) with ESMTP id 3161959806C; Wed, 22 Dec 2010 14:28:12 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=darkrainfall.org; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; q=dns; s= darkrainfall.org; b=qkGSOPvE9kfDo8FDHrFhCxOSQW0bZKw6U2pN8d825I/a VyvjES2ZBGqVqXSzotaoqjF07XcXvfykhls8xXSJ9JX2x3FVpGFIf2xozVihNd+l jCdMCSjMwa+jKyKMwHuxnaUOckmy3X5cioyAFlZMRfHlU1mlw1at2P1sOabO1/c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=darkrainfall.org; h= subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s= darkrainfall.org; bh=x9EBcdNHSz6MbuSaxWRAjqEx6Ds=; b=ONBd+4MS31q Eub5gciEwpqQYU1RAfZpG41I49e3W5hS7iWXbzk/L8kakF4rUIOlI1Wnp11hAjkX m/M5mLAXZ093RT263XOEDCjlA2SpvT7FLkkwFYhPxgQfsqlFQyhDbKZ2RS8LYo0C AwYHvTAFfS+Y7SZzzIKmBIi522yxOjfA= Received: from [192.168.1.3] (pool-173-48-161-16.bstnma.fios.verizon.net [173.48.161.16]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: gwynne@darkrainfall.org) by homiemail-a6.g.dreamhost.com (Postfix) with ESMTPSA id 61A0D598069; Wed, 22 Dec 2010 14:28:11 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Wed, 22 Dec 2010 17:28:09 -0500 Cc: Scott MacVicar , Stas Malyshev , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: <4D1254DF.9050704@sugarcrm.com> To: Mathias Grimm X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] RFC - MACRO From: gwynne@darkrainfall.org (Gwynne Raskind) On Dec 22, 2010, at 4:38 PM, Mathias Grimm wrote: > People always will want more, but some features are nice. > for C/C++ programmers, macro is on of the best things to make thing = work > every where. >=20 > its possible to create a IDE macro, but the native php feature will be = good. > template engines can de wrap this functionality too. > is just like a variable: I've long wished for preprocessing in PHP. It would be semi-trivial to = plug in libcpp from GCC or llvm's preprocessing library, if licensing = weren't an issue. If it is, then a reasonable homegrown implementation = of C's preprocessor semantics, or at least a subset of them, isn't that = difficult. Piping through cpp has two major problems: 1) It's an extra runtime step. Slower, more error-prone, not always an = option (shared hosting anyone?). 2) cpp doesn't understand # comments, single-quoted strings, heredocs, = etc. Many PHP scripts therefore produce annoying/confusing errors. Some issues with PHP-native preprocessing: - Are eval() strings subject to it? At what stage, outer script = processing or the eval string? - #include/#import versus include()/require() - confusing - Does preprocessing take place outside whatever PHP tags are active? > On Wed, Dec 22, 2010 at 7:08 PM, Scott MacVicar = wrote: >> I really dislike this, what about resolving orders, then people will = want >> undef, then ifdef with conditions. >>=20 >> The language doesn't need to introduce anything that makes it more = complex >> to use. >>=20 >> - Scott >>=20 >> On 22 Dec 2010, at 11:55, Mathias Grimm = wrote: >>> I Just want a simple replace-on-the-air to avoid spend time writing = more. >>>=20 >>>=20 >>> On Wed, Dec 22, 2010 at 5:43 PM, Stas Malyshev = >> wrote: >>>=20 >>>> Hi! >>>>=20 >>>>=20 >>>> I want to request a C/C++ feature that i think is good. >>>>>=20 >>>>> MACRO >>>>>=20 >>>>=20 >>>> You know that you could write: >>>> >>> #define PF private function >>>> #define SCOPE_CLASS(x) class MyProject_ ## x >>>>=20 >>>>=20 >>>> class UseMacro >>>> { >>>> PF preSave($object) >>>> { >>>> //... >>>> } >>>>=20 >>>> } >>>>=20 >>>> SCOPE_CLASS(Internal) >>>> { >>>>=20 >>>> } >>>>=20 >>>> And then run it through CPP (gcc -Mcpp -E - - < in.php > out.php) = and >> get >>>> all the macros processed? >>>> -- >>>> Stanislav Malyshev, Software Architect >>>> SugarCRM: http://www.sugarcrm.com/ >>>> (408)454-6900 ext. 227 >>>>=20 >>=20 -- Gwynne