Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104755 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60953 invoked from network); 15 Mar 2019 19:40:56 -0000 Received: from unknown (HELO mail-ot1-f44.google.com) (209.85.210.44) by pb1.pair.com with SMTP; 15 Mar 2019 19:40:56 -0000 Received: by mail-ot1-f44.google.com with SMTP id x8so8884473otg.7 for ; Fri, 15 Mar 2019 09:31:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rC3sahXVXXVJ4EqTZNVlm7MwSn3k6mXfvjbSGGswnKA=; b=FBFEvbm3u2IBJabZi9CF3KvnTLnh2LnEbu6AdPPuZJ/mmgY3yvv47VW1B35ru1P5w+ /STKGvItnaI9wrDL6wAsKj6MY3ZvOp5LJW2sZVZIE3z9Xlr5ljE6ogxlsU6w5a9PP0A+ H+73aSP8hBetq+M44cdlHMP2ZuxY+nldnUv2qv9m1TJWb42WiGp0MkVjEriPUtFYMR/q T9iaM6v3ZVchSjoKkFF0pr7oz7iUygA/8xZvu5tWIxpZoE5WH/+exEEl+4CybfYTFFBw FjEh4h4U3J1Pc/VJQgBqEGM+s/8tHjK3zVeffoTB3f37qtb8rGtYvRhF2r6FBqebRp2h lTYg== X-Gm-Message-State: APjAAAUYpr3Yr1lVneesJoKeIil1qLEE9fyo6hfft1YC5jzxuM6YVCJD 8gK4N9ChRMyhRWVimo0xgigV/QxxtxO5DX1qGN0= X-Google-Smtp-Source: APXvYqwo32jp/qRteR8D//mV1QQJMJa5L5zyOv8Nie1rUyeQzqhLnj+OyUdlakYZxe3i9uvM63/WJptmZHK6xHAJ/uQ= X-Received: by 2002:a05:6830:1297:: with SMTP id z23mr2985531otp.257.1552667496518; Fri, 15 Mar 2019 09:31:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 15 Mar 2019 18:31:25 +0200 Message-ID: To: Nikita Popov Cc: Andrey O Gromov , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Proposal for deprecate alternate syntax(curly braces) for array and string access From: kalle@php.net (Kalle Sommer Nielsen) Den fre. 15. mar. 2019 kl. 17.06 skrev Nikita Popov : > I'm okay with this. This syntax has already been deprecated once, though it > was reverted for reasons I don't remember. > > There are some people using this syntax to distinguish between array and > string access. It's a nice thought, but as the vast majority of code > doesn't make this distinction (I think the only time I saw this in recent > years was inside some old PEAR code), it's not really a useful indicator. I personally use it because I like to quickly tell if I am doing an operation on a string or array, it is eye candy and makes a lot of sense. I think if anything the two syntaxes should be decoupled instead. From a usage PoV, then from personal experience (outside my own projects), I have seen many usages of this syntax, even as late as my current company with a growing codebase that is nearing 1.1m LoC, I have seen this syntax used countless of times. In fact I don't think I have been working with a code base where I have not seen this syntax used. I have asked fellow developers around in my community today and they have no strong opinion on either, but do like the distinction between. > The rarity of its use also makes it rather confusing. While $foo[$x] is > well established as an array or string offset (or for that matter, > ArrayObject) access and will be recognized by any programmer coming from > any number of programming languages, $foo{$x} certainly is not, and is a > WTF moment for people who don't happen to personally use this syntax. > > I'd prefer to phase out this syntax entirely and not reuse it for any other > purpose. Reusing syntax is generally a not so good idea, because it means > that the same syntax has different meaning in different PHP version. For me personally it is a huge -1, if anything I would like the string[] syntax decoupled. -- regards, Kalle Sommer Nielsen kalle@php.net