Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112208 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 54550 invoked from network); 8 Nov 2020 17:25:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Nov 2020 17:25:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6034F1804B5 for ; Sun, 8 Nov 2020 08:47:16 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 8 Nov 2020 08:47:15 -0800 (PST) Received: by mail-lf1-f43.google.com with SMTP id f11so2490358lfs.3 for ; Sun, 08 Nov 2020 08:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X57HPMlnCRUgFmVXK72ONqjgZnPhV9nxRFzMToxxgIc=; b=SZsGNPxYUvjx8gKVK/vVpRgYuMMv6q0BEymE2laRO4eOuLWc0N+E/BN2chmLB3CuLm X5/0AAXyfFdZColb7SicAOsRorkQlK04YpilnM5MfQwr8occixbjBzFRc0kOfXjUgIgN U9EoXOXiNUx2Pc3XE51qI2/9ZT24YGGujK/3eRPuArEtRZzD7ObIFBzRF1JkRXQmR1pN hdfj4+WB9v0Iep8uXNZ+WEmVh74ISAZsXZYV7u86V8jAqGHAzOvJ/zT7xGI3Xadn3VJY ljqbeLzX7aW/OvLmNMgHTmK4TWYOlZwDBsQ0epp7uf7F+ZxBGeGjqgFLUUZy9ugjEXRu iNyA== 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=X57HPMlnCRUgFmVXK72ONqjgZnPhV9nxRFzMToxxgIc=; b=hxWxZ8bCzUTs+ASLO33sqRHeeKkJ826LaiND7UoOJr04Ze+lFjwDH+yQ5+pLt+NCZF X+rfTAi1/4M3LBhNMuBciT5X42Cm3tXhUDUR+xAyIyUflZ4HwFuflyItaG7Nd2XXr8F0 x+leSKTBt8vXLm9PkF1oDHc6YhT2C3noguGwC+0VPW8Be3k3GKEASRuVYEwDOcqBKEdb hfLxb7bzgi7QiCbTrx2c4tG4jR/Eayom06OvC8raB6dcAHKTO/zuaGq6Blv4SyNRDLGJ dOTo2A/Eb2QmPVB00uUoeIEo7o7RfsGlZ93dAk1BZjxv1JFOXQjLJPKnbh1FRdpwx+2v 7dXA== X-Gm-Message-State: AOAM5337O55UaOSN2Fkxm+GLO6P6LJkXaoP1Kfqy9AqsktjjQXLNeIl9 8fZ/gJJPfzPH1VhGPrzkSBsPSq7JRH9KXQmEPqE= X-Google-Smtp-Source: ABdhPJx2CySdtu1jT8E6cyESaQY/mLtb70UVNX++DsxfD9p2BQC76WJg8xyEj0FL9vbAp8k+32fqIjmDDF64aNYp4Hk= X-Received: by 2002:a19:ac4c:: with SMTP id r12mr803990lfc.109.1604854033609; Sun, 08 Nov 2020 08:47:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 8 Nov 2020 18:47:01 +0200 Message-ID: To: Marco Pivetta Cc: PHP Internals , levim@php.net Content-Type: multipart/alternative; boundary="00000000000096fa0905b39b320e" Subject: Re: [PHP-DEV] Union `&` operator From: zsidelnik@gmail.com (Eugene Sidelnyk) --00000000000096fa0905b39b320e Content-Type: text/plain; charset="UTF-8" > As for when to allow them: as others have suggested in this thread, keep it simple for now, and only allow intersection of class/interface references. Yes, I think that single intersection type should support just one class and any/or any number of interfaces with the condition that they don't collide with one another. > If you want to raise an RFC, special care has to be taken for the variance in inheritance semantics. I don't think neither that I am able to consider all possible impacts to write the RFC nor implement this, but Levi Morrison (levim@php.net) can. On Sun, Nov 8, 2020 at 4:53 PM Marco Pivetta wrote: > Hey Eugene, > > On Sat, Nov 7, 2020 at 4:13 PM Eugene Sidelnyk > wrote: > >> ```php >> function foo(A & B & E $object) { >> // some work >> >> var_dump($object); >> } >> ``` >> > > Fully support this for parameter, property and return types: already > making good use of intersection types since a few years. > > As for when to allow them: as others have suggested in this thread, keep > it simple for now, and only allow intersection of class/interface > references. > > If you want to raise an RFC, special care has to be taken for the variance > in inheritance semantics. > > Greets, > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > --00000000000096fa0905b39b320e--