Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84417 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37600 invoked from network); 7 Mar 2015 22:36:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 22:36:43 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.48 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.218.48 mail-oi0-f48.google.com Received: from [209.85.218.48] ([209.85.218.48:38152] helo=mail-oi0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/10-34956-97D7BF45 for ; Sat, 07 Mar 2015 17:36:41 -0500 Received: by oiax69 with SMTP id x69so23463061oia.5 for ; Sat, 07 Mar 2015 14:36:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=5e9I4LcwiJQ7xJ0BzLidf/g1sI0klTa2PpO4fUHPXHQ=; b=QYtCK+aEaSFXISloCsGTysRsI4IVKVWDZaVTc9lcV4XHshH7+DJzMyXCElmTBg5efZ KBVvx5uQQtX/LZJUQ9Y2Ole88OwkwnZZB0iTnGhy5nfDOIQ4UEwMsTY06HNdLuV6WVHD eieQUOhnZlAbI2rqSSA4UXasjYg7TdFtlc89VinV9MO5AwzTyvVUwtiOlHsIJdfQDray piNfa0EVs17WzcS0fypI0101eQarvAzixeOpoapO7vgMZB9DmXfhVxuRniS5opIcNP2D JX6hQqfqfClka2/MNfvVIbHUBe6/Vn4JuYtjtUwYvcGjy8SZzXYAInJqKARkl6djFIG2 vyEw== X-Received: by 10.60.156.168 with SMTP id wf8mr16061054oeb.5.1425767797832; Sat, 07 Mar 2015 14:36:37 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.58.2 with HTTP; Sat, 7 Mar 2015 14:35:56 -0800 (PST) In-Reply-To: <54FAD3D5.2030509@lsces.co.uk> References: <726CA870-917C-4270-A129-AFE106E0A380@gmail.com> <54F84208.4020709@lsces.co.uk> <54FAD3D5.2030509@lsces.co.uk> Date: Sun, 8 Mar 2015 07:35:56 +0900 X-Google-Sender-Auth: CvbKdaCejzzODaL21v99SdDiJR8 Message-ID: To: Lester Caine Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e01182b761f5d8b0510ba6f0c Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] Consistent Function Names From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e01182b761f5d8b0510ba6f0c Content-Type: text/plain; charset=UTF-8 Hi all, On Sat, Mar 7, 2015 at 7:32 PM, Lester Caine wrote: > On 06/03/15 23:18, Yasuo Ohgaki wrote: > > Hi Lester, > > > > On Thu, Mar 5, 2015 at 8:46 PM, Lester Caine wrote: > > > >> On 05/03/15 09:40, Rowan Collins wrote: > >>>>> > >>>>> Good point! > >>>>> I'll update documents so that main function is prefered name/function > >>>>> to be > >>>>> used. > >>> This would be fine if all the users read the manual, and only the > >> manual. What about the thousands of books, tutorials, blog posts, Stack > >> Overflow q&as, etc, all mentioning the names and behaviour that have > been > >> around for 15 to 20 years? Not to mention the thousands of lines of > >> existing code which people will not only need to read and understand, > but > >> also contribute to without accidentally breaking compatibility with old > >> versions of PHP. > >> This is perhaps the key ... > >> > >> Yasuo has at least now come on board over the IEEE standards but has > >> also spotted that because of allowing a little to much freedom in the > >> past some of the current guide lines do not marry with the well > >> established standards :( > > I've updated the RFC to have IEEE names as well as other established > > library function > > names as valid names. We wouldn't have much problem having aliases for > it. > > I think it would be useful. > > One of my own personal gripes has always been that while some names are > consistent with the standard, the rules for adding names adopted at the > time wasn't? It is this which has created the problem and if there is > any reason to change things now it should be to follow the IEEE coding > style which is also followed by secondary libraries like gettext. > > is_int should simply be isint in line with the IEEE standard but that > divergence of standards was not a good enough reason to avoid the > current 'inconsistencies' at the time? > I don't know how CONDING_STARNDARDS is made. Anyone remember the discussion? PHP has function names copied from C libraries at the beginning. Then name with "_" became standard. Therefore, we have phpversion(), isset(). I remember empty() discussion whether it should be is_empty() or empty(). Shorter name is preferred and empty() is used. We chose inconsistent names on occasions like StdClass::__set_state(). Having C library like name is not bad, but I think too many aliases are better to be avoided. Especially for basic functions. I'm not sure if it's good for PHP to have isstring(), isarray(), etc. It's one possibility though. > > > The bit I'm still unsure of here is not so much messing with some of the > >> fine detail of the procedural based functions, but the coding standard > >> that ACTUALLY applies at the object level. Using one naming standard for > >> ths area and a different one for an object version of the same set of > >> functions is equally confusing? > > > > I agree. I wouldn't rush into. > > If we change, we should change them right. > > > > We have the implementation already. > > http://php.net/arrayobject > > > > I looked into the implementation. I'm surprised that it's overly > > complicated. > > It uses "array(hash)" and "object" for array storage for some reasons. > This > > makes it difficult to reuse procedural implementation. We may do > something > > for this issue. > > One of the reasons I don't think it as caught on? > But the starting point here is naming methods in these objects and the > 'assumed standard' seems to be camelCaseStyle rather than under_style ? > Again the horse has bolted since objects like http are now well > established with camelCaseStyle rather than following the C coding style > anyway. > > The only question that needs answering first is just what standard ARE > we working to and what should that be to be consistent between > procedural and object models? Function names without "_" is better for camelCase methods. I agree. Personally, I don't have any bad impression for having "_" for procedural functions while having camelCase for methods. It's valid option to have camelCase for procedural functions' main name. I don't mind removing "_" from procedural functions much, but C library names are not standardized well enough. (I mean naming convention differs library to library) My current impression is having "_" in names and have PHP name would seem more consistent. I guess this is the reason why CODING_STANDARDS is made like it is now. We may introduce new procedural naming standard with camelCase name that can keep consistency. Thoughts? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e01182b761f5d8b0510ba6f0c--