Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71205 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99783 invoked from network); 17 Jan 2014 09:33:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2014 09:33:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.128.169 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.128.169 mail-ve0-f169.google.com Received: from [209.85.128.169] ([209.85.128.169:64707] helo=mail-ve0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/A0-29925-FE8F8D25 for ; Fri, 17 Jan 2014 04:33:36 -0500 Received: by mail-ve0-f169.google.com with SMTP id oy12so946674veb.0 for ; Fri, 17 Jan 2014 01:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=lo/Ae/bEWvizcoq+5FjCV5dcqCWk+fDgFD6/H0sn2hs=; b=SoLOnm+bQsWXr+PFfG3VHvE/QiInAMrv7cS4hrIJfiXih9MmHm7WjKjg4MKNHuuFg+ aLr0djqnUCp1I8WigoZI9mb48eeH5l1e3U5R0t2X4YxMIqSXxPgv2wQlsnj/1f7EMI/4 +zfBo+B3CqEqxVGQf5fcuz3MI9tVFFnXwOLhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=lo/Ae/bEWvizcoq+5FjCV5dcqCWk+fDgFD6/H0sn2hs=; b=E/INba7uhcbPUor6q+IcTXrN2M9R89iqauMfMw1pZooxEpDmOzEj5I2QTDo365opLP cnqiEq1jxZf8KMfdxfNXRC3vRz5rz7bKatFrcF7daHVpKi2iIC8Dg0AtBquweKe6rrYK 2Qm+aZmvFuAgBMsJ6RXwEUI61jsDw1ZcfXyViH/qpiq6zdPHaD6bDNq68fhXt0B5HcxM /mNoWm4x71up9GwQ6ZKOs8uoypQ+cuwtd/lymptMBCHpHHW8QVXQh4PBLUaGsI3wwabg 3VCYvYYB5kVtXLyUgKYT/kf0g2Czx0bJ8FXSQA1Cyke+EOejcFJxFq/hBBY9K4QNSGSD ZgQg== X-Gm-Message-State: ALoCoQmY6xwa5abKC5yfqhL8kR1XuAizycAzdN/amTJmWao2TCISDNwBDWGyqvXuJUfFlJoz+4GJ MIME-Version: 1.0 X-Received: by 10.52.106.107 with SMTP id gt11mr335693vdb.7.1389951212402; Fri, 17 Jan 2014 01:33:32 -0800 (PST) Received: by 10.58.196.225 with HTTP; Fri, 17 Jan 2014 01:33:32 -0800 (PST) In-Reply-To: References: <52D865C7.4070009@sugarcrm.com> Date: Fri, 17 Jan 2014 11:33:32 +0200 Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1133ccf645822104f0273c3b Subject: Fwd: [PHP-DEV] Introducing "Array Of" RFC From: narf@devilix.net (Andrey Andreev) --001a1133ccf645822104f0273c3b Content-Type: text/plain; charset=UTF-8 On Fri, Jan 17, 2014 at 1:05 AM, Stas Malyshev wrote: > Hi! > > > It's easily readable and everybody should be able to recognize what this > > thing does even without prior knowledge. > > > > Hell, why not Array[Foo|Bar|stdClass|whocares] ? > > > > Or even (at a later stage): > > > > Array[]["key1", "key2"] > > I don't think inventing another language to specify types inside PHP is > a good idea. If somebody is really into type calculus, there are many > academic languages to play with. In practice, such byzantine constructs > rarely make developer's work easier on tasks that PHP is commonly > applied to. If you want a language that can run code to check if your > array conforms to arbitrary set of rules, what's wrong with PHP language? > Maybe I wasn't clear enough about it, but I did note several times that what you quoted is not in the current scope of the RFC we're discussing. I was trying to explain how this syntax would be forward-compatible and instead of commenting on my main point, you take this single part out of context and somehow manage to twist it like I was saying something against PHP - not cool. Anyway, I'm not attempting to invent another language (or rather, a "sub-language") for type hinting. In fact, I was trying to make it more similar to PHP's current syntax. Array typehints currently are written via the 'Array' keyword, hence why I find the originally proposed 'className[]' to be a bit bizzare. The '|' character is indeed new into this, but it is close enough to the || "or" operator that everybody is familiar with and a comma wouldn't really hint at "or" at first glance. Cheers, Andrey. --001a1133ccf645822104f0273c3b--