Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109749 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26443 invoked from network); 21 Apr 2020 12:58:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Apr 2020 12:58:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C3DF81804CB for ; Tue, 21 Apr 2020 04:30:07 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-vs1-f43.google.com (mail-vs1-f43.google.com [209.85.217.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 ; Tue, 21 Apr 2020 04:30:06 -0700 (PDT) Received: by mail-vs1-f43.google.com with SMTP id e22so2981884vsa.12 for ; Tue, 21 Apr 2020 04:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lBxUUVQpoIobJWhwbhGEjM9/suoWFiwZE5WNP5xpD0s=; b=hWFSGHIDz85V6GXeEFccmJ3d969SM/UK49ywYm/WX0WBFkSZhbQsWdcDc3z03u0qro JcAoiK+hpGeLShL64HKrFBlgK8DAdR0J3UbUFVumvypFjZ1xnV5Qj+1nb85sf8Sn4zkG B1Y0HqneqzrCBA4EJIyo9tbXg8JydnthtymSJiBpimfD4kYmIT8VLqo6rsLkJ0orBTJ3 xho29yyeYA1Y72+RXvuyjSPAB3zeVV5YmH8bD4wosBzZ5QjGWLj+1RcvWoPf/1z0SYBz OCJFEwzlAJ2p7lDlAnkp2FJkwg8uGBWQrnIAPUaYOVVxG3EeyPXZsRFbXFJfRKSHrABZ bDtA== 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=lBxUUVQpoIobJWhwbhGEjM9/suoWFiwZE5WNP5xpD0s=; b=RyeLatwtBagmL8PXWH8iVp/J8poFvaw6bBWyZdj0HJlsY6eV4DPvNu7MyuKq/twDQy Z8uGHgj3DHXqgeeOHSjY7lvGc7WY4R1uQTaoZbcU75/tJiCVl1vQWEydvWTK6/VkLGkR Zfao6/pdl8zVPhGrCz6v1pZLL/lLxVv/OocqKrWk6x6XWTk3uBO4EFkV0qw6Ssz8MzTx z2/hmSPGaSiKrC5/FhVMchQ80ZndClH0JFf3aD2XYoW6evoow4sDVF8SkZFmKWuvpBo3 +e0Su3p/Ke0XPxlzYIH5lh6bXqn5mwpfoCiV8EMFohQuOrl32SvjuYeLXac3gH9QRpgb Wr6Q== X-Gm-Message-State: AGi0PubFp1A5qiyG+JhV3Q6yMmU+SnQqe7HDpdH/TLHmlA6oNqrWNzo3 qEbL3tQr1z1xiNaEyPHmoI6N7W0YvLbl6KKWmtkqE1kNNYU6zA== X-Google-Smtp-Source: APiQypKtR1+ZegepnL9mjp1hJE4tCUotCQwGxOBh1Xx0REYejeYCxA+EDiqRXvye/Va00nllk9RpQyy+LBHG7+cjScI= X-Received: by 2002:a67:334a:: with SMTP id z71mr7497476vsz.87.1587468606302; Tue, 21 Apr 2020 04:30:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 21 Apr 2020 12:29:55 +0100 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Mixed type From: Danack@basereality.com (Dan Ackroyd) On Mon, 20 Apr 2020 at 16:17, Larry Garfield wrote: > I... cannot actually envision what code would actually accept that mess. :-) var_dump() would be one example. Also caches that can store any userland value would be another reasonably common use. The general pattern is when you're handling someone else's 'data' and have no restrictions on what type that data should be. That's actually the use-case that prompted me to help draft this RFC. > now that we have Union types what places are > there where the currently available type declarations are insufficient? A type that explicitly allows any type is more forwards compatible than writing out a union type. Compare this: var_dump( mixed $expression [, mixed $... ] ) : void to: var_dump( null|bool|int|float|string|array|object|resource $expression [, null|bool|int|float|string|array|object|resource $... ] ) : void If/when we add an 'enum' type that is not a child type of any of the current types, the signature of that function doesn't need to change if it uses mixed, rather than the written out union type. Also, the 'fitting on a line' problem. cheers Dan Ack