Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65618 invoked from network); 4 Jun 2016 13:48:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 13:48:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.163 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.163 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.163] ([81.169.146.163:23153] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/54-25194-91CD2575 for ; Sat, 04 Jun 2016 09:48:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1465048086; l=5757; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=7liQ5RWuPRXuSMlazHFjg0y5I4HU6I7lV0XJLirTOZc=; b=iSsBjHJpIvA+LCLAB2/56DANQM56eAtGJtXpH8H+z8kHHV2oVBYjkHq8FoRGsInMK6O /CH0Q7dZX0Vh8eP4D99ZoJk8MBnAHv0cFB8v60rYFkoRSYpKIEJYZcnFRekoug/YSOB8V izmImTHBuCeO6W6UEDSw5PoUUCxnnR4CMM4= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtOnc6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f54.google.com ([74.125.82.54]) by smtp.strato.de (RZmta 38.2 AUTH) with ESMTPSA id K03651s54Dm46Ms (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Sat, 4 Jun 2016 15:48:04 +0200 (CEST) Received: by mail-wm0-f54.google.com with SMTP id a136so32252377wme.0 for ; Sat, 04 Jun 2016 06:48:04 -0700 (PDT) X-Gm-Message-State: ALyK8tLon9awwu5OoTm0fHULqVfCiZzbrLjE2V24Y/LYMmjfqtZKdRn/aru5AAoJFOQodcXpKIJYUfr7vh2Eqg== X-Received: by 10.28.59.193 with SMTP id i184mr4086674wma.73.1465048084343; Sat, 04 Jun 2016 06:48:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.53.132 with HTTP; Sat, 4 Jun 2016 06:48:03 -0700 (PDT) In-Reply-To: References: <0A.C5.62101.1C860575@pb1.pair.com> <68b821ac-d71f-4be5-8dca-ae94db332630@gmail.com> <20160603101659.D466A1A81FC5@dd1730.kasserver.com> <6d448fd8-8fda-d795-accb-6b96cd128ccd@gmail.com> <652fdc5a-a164-2054-ed61-305a2b72330a@gmail.com> <20160603142421.346B81A81725@dd1730.kasserver.com> <9814df22-9854-616b-bf02-d0742efefaff@gmail.com> <20160603145857.8413F1A8323C@dd1730.kasserver.com> <1fb072b3-9b9e-1dfd-6b39-7875587b6c7d@seld.be> <5751B50F.2090003@garfieldtech.com> Date: Sat, 4 Jun 2016 15:48:03 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Bob Weinand Cc: Larry Garfield , PHP Internals Content-Type: multipart/alternative; boundary=001a114a54baa57f40053474169b Subject: Re: [PHP-DEV] [RFC] [PRE-VOTE] Union types From: me@kelunik.com (Niklas Keller) --001a114a54baa57f40053474169b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > Massive is a nice hyperbole here... > Sure, you can check it manually=E2=80=A6 but why not just always check it= manually > then? > You then loose possibilities to reflect on it, have static analysis rely > on code only [currently you always have to check docblocks when it's not > declared; definitely not an option for e.g. Optimizer], and a single > signature is generally easier to parse for a human. > Talking about reflection, I'm not happy with the currently proposed solution. > ReflectionType::__toString() will now provide a full union type as string; e.g. =E2=80=9Cint | float | NumberObject=E2=80=9D. That requires libraries like Auryn to manually parse that string now. It's no longer possible to directly use __toString to get the class name. Isn't there a better solution? What about ReflectionType::isBuiltin()? What will it return? Just false? True if only built in types are used? I think allowsNull can be handled as is. See https://3v4l.org/int0g#v700. > Also, I don't believe it's the languages task to put arbitrary limitation= s > on this. If a library does this, that's the libraries problem. But a > language should not do that and try to support full typing. We've decide= d > to make PHP (opt-in) typed on function boundaries (and eventually soon on > property storage boundaries), so we should also finish what we committed = to > instead of putting something half-arsed forward. > > For Aerys\Host it could also be solved with an interface that just doesn'= t > have any methods. With the disadvantage of callable not being in the same > signature anymore. > > > As you say, disadvantage of callable. Also, it requires you to inverse > responsibilities. You'd have to specify a common super-interface on every > single fundamentally unrelated interface (which are only indirectly relat= ed > by the fact that they receive common handling in a single place). That's = a > clear anti-pattern. > Additionally, this is only possible if you are actually in control on > these classes and can change them. If you pull them from a library, no > chance. > > Bob > --001a114a54baa57f40053474169b--