Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92948 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81713 invoked from network); 29 Apr 2016 16:45:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2016 16:45:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=codekestrel@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=codekestrel@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.67 as permitted sender) X-PHP-List-Original-Sender: codekestrel@googlemail.com X-Host-Fingerprint: 74.125.82.67 mail-wm0-f67.google.com Received: from [74.125.82.67] ([74.125.82.67:33378] helo=mail-wm0-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/10-26386-1CF83275 for ; Fri, 29 Apr 2016 12:45:53 -0400 Received: by mail-wm0-f67.google.com with SMTP id r12so6260162wme.0 for ; Fri, 29 Apr 2016 09:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=O22uYL2U5eX6ZGSwoyRZDTPT/ZsPKAW8XNp000shxcU=; b=l0TYDMkzo2v0vjU2/i54hRJs+JbDNroRUVvZj9dgw+p3i1jKRl2hXX7tC648FNJCBF nAhVUIT6u8z1KZyP5RiMnTRyToHnihBh/P84WEnkdcxbctjgGFlZiQBds7O7rVladVbs hZTBMF/zC+pax48Qq3e4XGext1LyqohkgLPMXI3JyQ43gFi2qGZxv2TBz5c2ImvEdJTE HuQZnYEPZ1Cx0f3WLldyuD5PFoVZF9LREWx3ap/CHPnPUqcghkgIRo2aNrdeUtXIvUIh JkeR4VGrNRUCw1J2mxyKW8wZBo9/cu6I9ezocW6ETZPCj3BuregHrCLEDpRvUC8/GiLy GcsQ== 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; bh=O22uYL2U5eX6ZGSwoyRZDTPT/ZsPKAW8XNp000shxcU=; b=fmTHI6YzNEdGeZCYxFxw15i+Wa8LQtruPlsMaQ4+UxthZNNTz/qEup/0KPui1p6IGS e1bv/Ja5eVOzJjK9kD/vlRfEsZ0cjI1FYN2QjhjQFAlBpGp0qZhR1YAhOq/chtxLyTpv MhGY3XFWPd9su6ysbRJTgbQrW2PDZaOdJVQlD0t4gwQYIsrJi6ip674uROlOATI88pUt nENkZTlsXPh9NUtiYJ0PHv4hezlbvWd4mUnP54uqtEXv1xxlj7+qXPT8Mccip7/dPAji Ns566mQ8Y0UzJXpkKiyIf95fp6/eFevW0PTOkWx6luWePyikIiuyBTgWzP3Qb7vX3Hul AspQ== X-Gm-Message-State: AOPr4FWeXDjNy5PeDnuyLUK4qTqz7psgwueC0Rjy6j+dndZlheNZoCGDKIaNglAdmzTZum76SvKwj0MXYgMpnw== MIME-Version: 1.0 X-Received: by 10.194.115.196 with SMTP id jq4mr22599792wjb.101.1461948349927; Fri, 29 Apr 2016 09:45:49 -0700 (PDT) Received: by 10.28.140.10 with HTTP; Fri, 29 Apr 2016 09:45:49 -0700 (PDT) Received: by 10.28.140.10 with HTTP; Fri, 29 Apr 2016 09:45:49 -0700 (PDT) In-Reply-To: References: <57173859.4080501@rochette.cc> <013101d19ff8$596b6010$0c422030$@tutteli.ch> Date: Fri, 29 Apr 2016 17:45:49 +0100 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1130cd7c13d84b0531a260ef Subject: Re: [PHP-DEV] [RFC:generics] From: codekestrel@googlemail.com (Dominic Grostate) --001a1130cd7c13d84b0531a260ef Content-Type: text/plain; charset=UTF-8 This means then that to use a subtype for the type argument, it is safe for the function to READ the argument, but unsafe to WRITE to it. Conversely. If the function accepted List, but was theoretically given List, WRITING would be safe, but READING wouldn't. Given this, it doesn't matter how it's done, both scenarios are prone to error, and the only options are to either accept that or disallow it. On 29 Apr 2016 5:11 p.m., "Rowan Collins" wrote: > Dominic Grostate wrote on 29/04/2016 16:59: > >> >> After reading your email again, I find myself agreeing. This is because >> I don't consider List to be a subtype of List. >> >> LinkedList would be a subtype of List, but inheritance >> doesn't really extend any further beyond that, for the reason you have >> illustrated. >> >> > > Precisely, the rules for variance of the type parameter are not > the same as the rules for variance of the generic class List itself. The > exact variance that you want is different in different situations, so the > safest assumption the language can make is to make the type parameter > invariant by default, and then possibly have a syntax for you to state that > you want covariance or contravariance in specific situations. > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1130cd7c13d84b0531a260ef--