Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36783 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73458 invoked from network); 3 Apr 2008 08:53:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2008 08:53:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=johncart@cisco.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=johncart@cisco.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cisco.com designates 144.254.224.140 as permitted sender) X-PHP-List-Original-Sender: johncart@cisco.com X-Host-Fingerprint: 144.254.224.140 ams-iport-1.cisco.com Received: from [144.254.224.140] ([144.254.224.140:13913] helo=ams-iport-1.cisco.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 80/71-65398-9FA94F74 for ; Thu, 03 Apr 2008 03:53:13 -0500 X-IronPort-AV: E=Sophos;i="4.25,597,1199660400"; d="scan'208";a="5252282" Received: from ams-dkim-2.cisco.com ([144.254.224.139]) by ams-iport-1.cisco.com with ESMTP; 03 Apr 2008 10:53:06 +0200 Received: from ams-core-1.cisco.com (ams-core-1.cisco.com [144.254.224.150]) by ams-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id m338r6mC031614 for ; Thu, 3 Apr 2008 10:53:06 +0200 Received: from xbh-ams-332.emea.cisco.com (xbh-ams-332.cisco.com [144.254.231.87]) by ams-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id m338r6d3000268 for ; Thu, 3 Apr 2008 08:53:06 GMT Received: from xmb-ams-33e.emea.cisco.com ([144.254.231.75]) by xbh-ams-332.emea.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 3 Apr 2008 10:53:06 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Thu, 3 Apr 2008 10:49:29 +0200 Message-ID: In-Reply-To: <47F463F0.4030407@zend.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] intl naming Thread-Index: AciVR34y0+aL78+8SwGZDyhbQitbQAAHMmgg To: X-OriginalArrivalTime: 03 Apr 2008 08:53:06.0353 (UTC) FILETIME=[223BA210:01C89568] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=4615; t=1207212786; x=1208076786; c=relaxed/simple; s=amsdkim2001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=johncart@cisco.com; z=From:=20=22John=20Carter=20-X=20(johncart=20-=20PolicyApp= 20Ltd=20at=20Cisco)=22=20 |Subject:=20RE=3A=20[PHP-DEV]=20intl=20naming |Sender:=20; bh=Z0cMpp0sFxAfSRhQWTM5aBzvRpNtkKzKTMtqQs0k5fQ=; b=Us4nFmc9mGr33XMn9ZNFrG84sAMtCOv+SrRQRoCG/eHt831nWiBnkt9R35 o+KwmZaWkbtDbgl8aGnarq7XTPXItiGlHfEnJ726LZL0NWTSWUi+KeH1UJ0e kLSO0O88xa; Authentication-Results: ams-dkim-2; header.From=johncart@cisco.com; dkim=pass ( sig from cisco.com/amsdkim2001 verified; ); Subject: RE: [PHP-DEV] intl naming From: johncart@cisco.com ("John Carter -X (johncart - PolicyApp Ltd at Cisco)") References: <47F463F0.4030407@zend.com> Stanislav, I like the look of the API. The naming convention appears logical, on the question of internal class names existing in userland I'm sure people will refer to the discussions around DateTime. Many extensions appear to offer procedural style equivalents to the OOP API, personally I think it would not missed if omitted - have you had any specific requests for it? On the API side have you considered throwing exceptions instead of checking error statuses? Also would it not be useful to have the DateFormatter optionally accept DateTime instances in addition to strings? Thanks, John. -----Original Message----- From: Stanislav Malyshev [mailto:stas@zend.com]=20 Sent: 03 April 2008 05:58 To: 'PHP Internals' Subject: [PHP-DEV] intl naming Hi! I wanted to ask the people here for opinions on the subject of functions naming in pecl/intl (hopefully soon to be ext/intl ;) module. Current state can be seen at http://docs.php.net/manual/en/book.intl.php First, a bit of background. Intl extension project was created with the purpose to bring internationalization capabilities of the ICU library to PHP 5, specifically 5.2.x and 5.3.x branches. We felt that as PHP gets more and more enterprise adoption, it needs to start supporting internationalized development much sooner than PHP 6 roadmap would allow us to. Thus, the goals of the project were chosen as follows: 1. Provide dual OO/procedural API for all functions 2. Provide same PHP API for both PHP 5 and PHP 6, to allow easy migration in the future 3. Keep same codebase in 5.x versions and keep codebases between 5 and 6 as close as possible 4. Have separate functional modules for each functionality piece (number formatter, locale handling, collator, normalization, etc.) with intend to add more modules as we go, while keeping single extension as an umbrella for them. As a consequence, we arrived at the naming scheme we have now in pecl/intl, i.e. classes named as NumberFormatter, MessageFormatter, DateFormatter, Collator, etc. and functions named as numfmt_*, msgfmt_*, collator_*, datefmt_*. The latter were chosed in accordance to the guidelines stated at http://www.php.net/reST/php-src/CODING_STANDARDS, saying: If they [function names - SM] are part of a "parent set" of functions, that parent should be included in the user function name, and should be clearly related to the parent program or function family. This should be in the form of parent_*. Recently, concerns were raised specifically about the name DateFormatter, which can potentially infringe on ext/date namespace, and in general about all the names. There were proposals to prefix all class and function names with Intl and intl_ respectively. While I feel that would make the API unnecessarily cluttered (since each module will have to keep its prefix anyway, we'd have stuff like intl_numfmt_parse_currency which IMO looks much uglier than numfmt_parse_currency, same goes for IntlCollator vs. Collator, etc.) However, technically it is possible to do such change, and I believe if it has to be done it has to be done now, when we have first phase of the development feature-complete and ready (up to bugfixes here and there) to announce the module as 1.0 version for everybody to use. So, I propose people to consider all the above and the following options: 1. Leave it as is. Pro: we have it now and it works, and it looks nice. Contra: see above 2. Rename only problematic one - DateFormatter to IntlDateFormatter Pro: minimal change, nice names stay and can be used in PHP 6 API too. Contra: one piece starts with Intl, others don't - API looks weird as a whole 3. Rename all classes to Intl* while leaving functions as is Pro: All classes in the extension look the same, functions still have nice names Contra: All classes get ugly names, and they are going to stay in PHP 6 where those will be recommended system classes (so not Locale but IntlLocale, not Collator but IntlCollator). 4. Rename both classes and functions. Pro: All API looks the same, purists are happy Contra: API looks ugly, too many prefixes for functions. So, please comment. If you have more ideas on the topic, please feel welcome to propose. We want to make this decision ASAP, so that we could move forward with the extension release. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php