Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83352 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16309 invoked from network); 20 Feb 2015 20:16:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 20:16:28 -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.214.171 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.214.171 mail-ob0-f171.google.com Received: from [209.85.214.171] ([209.85.214.171:36999] helo=mail-ob0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/C0-14173-B1697E45 for ; Fri, 20 Feb 2015 15:16:28 -0500 Received: by mail-ob0-f171.google.com with SMTP id gq1so26550764obb.2 for ; Fri, 20 Feb 2015 12:16:25 -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 :cc:content-type:content-transfer-encoding; bh=czVID9Nc/I5jkGGiKQrMM9CLiRvegpjyyo2VSUW5+7o=; b=seSn4TJvrO0a1Oc2lCe5tvXxxu64dAbmQY8xF2ysNRs7WnDK6n464UdMy9QfPWstCB I+7qbg5rM3acRnZnQQk50WJaLfPfN4CMEyo+D1U/ChU9zFF+nGnD6HrylgnFuuPMjNbp jL8ivBzJ7mOBnUxVq0ImhOTkwh4RiN/+wxUWs= 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:cc:content-type :content-transfer-encoding; bh=czVID9Nc/I5jkGGiKQrMM9CLiRvegpjyyo2VSUW5+7o=; b=auqaadkpajDbeizfI2f4rd/+MANslq90BkIf6Dyn3zcG9gIdYYRkaUKo6HxC3gKJoz Xyy8+CKRUu1pmEq062WAwAYOa9p/8pjfY1hNW61r2j63jBd5xpXcOfNIIHF42vDdxXzB 1kovzsJnVOyRzHokT0tYDRqUSbcm+w+lLoOI+FtU+hUbEb70rbG3YDN2Et+TTiwDWFIi oyjqewtSXt9pzsVj+JMP1jbtezZfDubN3+W9FfDTlUS7C/mO5mBCdXUHcmtjsYydQ4TW MNVW0WreSgD+8/k4myAKOg5ye9GtymWcFvLPdV9sBXPiJYqYX+OSBUX568mOpWqa1Ggu HjhA== X-Gm-Message-State: ALoCoQn1YEzY8Juxq/3nkF1coygHrAfRMPWjncjzlr1sl5SIkVRCLA/+jvwHpPbgPzdQAYB7GtLn MIME-Version: 1.0 X-Received: by 10.182.213.102 with SMTP id nr6mr7641136obc.5.1424463384900; Fri, 20 Feb 2015 12:16:24 -0800 (PST) Received: by 10.202.214.205 with HTTP; Fri, 20 Feb 2015 12:16:24 -0800 (PST) In-Reply-To: <052701d04d37$dd87d0f0$989772d0$@php.net> References: <04db01d04cc1$d9925770$8cb70650$@php.net> <052701d04d37$dd87d0f0$989772d0$@php.net> Date: Fri, 20 Feb 2015 22:16:24 +0200 Message-ID: To: francois@php.net Cc: Levi Morrison , internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [RFC] Reserving More Types in PHP 7 From: narf@devilix.net (Andrey Andreev) Hi, On Fri, Feb 20, 2015 at 8:05 PM, Fran=C3=A7ois Laupretre = wrote: > Hi Andrey, > > I think the question of reserving 'resource' or not is not the main one. > > The question of having to reserve keywords is much more fundamental and n= eeds to be addressed first. I expect it to be clear for everyone that, as l= ong as we share the same naming space between class/interface/trait names a= nd type hinting keywords, each addition of a new keyword will be a real pro= blem. So, we may reserve keywords in advance but it cannot be more than a w= orkaround. If we don't address the issue now, we'll end up with weird names= for type hints, just because appropriate ones are *too appropriate* and po= tentially taken for existing or future classes, without any way to evaluate= the potential BC break, let alone the potential introduction of a third na= ming space with a future 'typedef' feature ;). We see the case today with '= resource' but that's just the beginning. What about 'mixed', 'scalar', or o= thers I don't imagine yet ? The race to reserving keywords is lost in advan= ce. > > Another point is that, thinking the reverse way, developers can legitimat= ely ask why they cannot choose 'resource' as a class name, when the reason = for this is a design mistake made when the 'array' type hint was introduced= , or even before, when class hints were introduced without thinking the mec= hanism would be necessarily be extended. > > Just a detail: I respectfully suggest anyone not to waste time to explain= that the problem is solved by using lowercase-only keywords, at least not = to me ;) > > So, we need to propose a migration path towards a cleaner syntax. The STH= RFC we are writing proposes one, keeping it as smooth as possible because = the feature is heavily used. > > Back to the particular case of 'resource': As the future of resources may= be to be converted to objects while keeping the same API, the STH RFC will= propose to define the 'resource' type hint as accepting 'IS_RESOURCE|IS_OB= JECT', without conversion. Then the user who received it can distinguish wi= th is_resource/is_object() if needed. > > So, 'resource' and 'resource|object' will be synonyms, while more precise= users can use something like 'resource|object(GMP)'. All of these syntaxes= will provide full BC when switching from resource to OO. > > Thought ? > Sorry Fran=C3=A7ois, but I really didn't intend to go further into that top= ic. If Levi decides to add it as a second, optional vote - it's his proposal and that's fine with me. I only expressed my opinon about your suggestion to also reserve 'resource', because I don't have voting karma and RFC discussion is my only way of influencing decisions. Cheers, Andrey.