Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92380 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16899 invoked from network); 17 Apr 2016 11:13:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2016 11:13:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-ob0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:33234] helo=mail-ob0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/A9-32052-EDF63175 for ; Sun, 17 Apr 2016 07:13:35 -0400 Received: by mail-ob0-f170.google.com with SMTP id tz8so84466156obc.0 for ; Sun, 17 Apr 2016 04:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=MXFhNoPp3XL+Gax3fs6FE0QBlZbYY3c4pV3/cg7cmmE=; b=LcMh7vNx5xlpJ+xhsg5+R+90/oMuVb2JPxmaB+fVOz/0I2yHhl97qEyqRWrGOma4of r72M83L/jWoqYO1/J4CMdgrclMnrUdnjxn4dv4OnkH8alZ7O3uNewqosAigMvSiTXz3b sHQz7qpz7PeY0fQrbgLvzFXflsdtDtchRuOZF24sjC7S4O03gYSsgF17L3j5SQYo593A OJogUeTeRFBwH9gvvtSavOInCiTjEfyjdgKgv7BgHrhuqQDAWg5YJdu28voFQX5oMQI9 1VA+hMlAY+AwtSyElozlExPu3VdvQBCbkwv9NcwiJntGOHVumExw0EwcIwM14kXKa+pN RD9g== 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:from:date :message-id:subject:to:cc; bh=MXFhNoPp3XL+Gax3fs6FE0QBlZbYY3c4pV3/cg7cmmE=; b=OS+lpcpeV3jQuVjZQCj2x5neKDr+kV5PULlpZEKMplMqT/o0ZnC8sluwalaEB8uZxu 7QZsuNxaqe5eqFmGWJVCmt8SXGwf6dP0lo6ZVEM8Zxl2aRzrPv7DMIVXW46FW2GcPJnx y1B7K1lnpELw4BIDmZOD92+wO0vprNqI3v9T94GmWh1z5Fc151iSece5pfA/RxdqvC5q 8tzscxfoKdJSS6eVXfSAO4klfDa4nVFCcL0EvvdNwl8JvPiqMttZ0Hwe8iSTHIXiOWmk BgNQRwnx52UJa6s6dFTOH+i75DrUr6MYqIQCOIUx7ZToM/0UoUdx0NIk6YqsPjC1DT2e B/aA== X-Gm-Message-State: AOPr4FUvN8dbG5K/+evYSB+sWsxpq/kTDJkX/vGPrYsSfI5KR3rwt4/S+R4vDpksd3ZrusgQGxPv/1JMvC3k4A== X-Received: by 10.60.125.134 with SMTP id mq6mr14206045oeb.18.1460891611938; Sun, 17 Apr 2016 04:13:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.192.198 with HTTP; Sun, 17 Apr 2016 04:13:12 -0700 (PDT) In-Reply-To: References: <57126511.1010801@telia.com> Date: Sun, 17 Apr 2016 07:13:12 -0400 Message-ID: To: Lin Yo-An Cc: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , Levi Morrison , Derick Rethans , PHP internals Content-Type: multipart/alternative; boundary=047d7b33ce6095c8ec0530ac5582 Subject: Re: [PHP-DEV] [RFC] Union Types From: marcio.web2@gmail.com (Marcio Almada) --047d7b33ce6095c8ec0530ac5582 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi! You are everywhere :P 2016-04-17 6:28 GMT-04:00 Lin Yo-An : > I think it will be better if union type is only allowed in the "type" > statement, like what you described in your RFC. > > type Iterable =3D Array | Traversable; > > If we can always pre-define the types. > > And only allow just one type for each function parameter in the function > prototype, then, I think the performance impact of type checking in the > runtime might be able to be reduced. > > In other words, you predefine the union type before you used them, and th= e > union types can be reused in different functions, you don't write a lot > union type in function prototype. Performance issues aside, the ability to inline type expressions on function signatures --- function myMethod(A|B $arg){...} --- can be "nice" because it allows us to keep type definitions *private*. Assuming that a named type could be reused by third party code (as public API) and that may not always be the intended. Of course this would be much better addressed with first class packages where interfaces, classes, types etc can have their visibility defined. But until we get there, having the type expressions on argument lists may be useful. Cheers, M=C3=A1rcio --047d7b33ce6095c8ec0530ac5582--