Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109949 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 13120 invoked from network); 1 May 2020 01:09:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 May 2020 01:09:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 715AB180510 for ; Thu, 30 Apr 2020 16:43:36 -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,RCVD_IN_MSPIKE_H2,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-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (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 ; Thu, 30 Apr 2020 16:43:35 -0700 (PDT) Received: by mail-vs1-f54.google.com with SMTP id a5so5382348vsm.7 for ; Thu, 30 Apr 2020 16:43:35 -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=jqd4vdEVXeh64y/VkJPXMjsyRVwDpNeWB3NcL9CSlng=; b=06IUKDTg7rwEVfq6eSJrgmM+zVrPINlNW4eiR5oB20XwqDoT4S/PIn6tHIG17ALmk2 8LdNteyc07mcHbQlWMMndBaYBeCuPZIFTysZAbtiWkzMZ+TuHuw8B6TJlKtDZYA3Vz9Q 3Hj8GVbeToadtkzOPTYMvIN/Hd3bNs5lM+QFSmoIEVF3sfqnqxhMHQTInEuJbNEB1Iya obgKIQFHVlbtXWyhnuIpdzPqggzed6gPvq1uJjIP8iZqe963daenooC+filOh1ZJ3256 h77tvw4cx1nq/hlxtHeIiF54UlRFLN24dce3qOyJznN3ZVl3X0gg1D3Lvmg0koZxa/gV vt3A== 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=jqd4vdEVXeh64y/VkJPXMjsyRVwDpNeWB3NcL9CSlng=; b=PFo8rK8T45fVfPTm5tzmlMU0NK09D8WMehrW9lpCq1Kwo/f/7WvjWBELqLnRvmiGNw zezO99iWX54mVx0oz/e9XRlZZNOjnfRnnxNrS+o6g3xSGk31ZU6KSpfcF+fSslO+/aIz OS7ZrF2rPWnMPthjF1vXvqFY2TOuSgpmelgyjUOFtQ+HvKqpXPwAHjcBSL/QFTut0K2Z 1ih6biGrGNPjg+/x6Ngll94M8j8zfFKFKck6z4J5HfwzfYGOI59P4z/5Z4DdOngZilC8 WV/By2Ta2EY+KZGW9Sjy/hZ+WcpJtz+uSTOTJXCzRXb90oW0gXVO9cPP7LGbVd8qg0xe RL1w== X-Gm-Message-State: AGi0Pua3O50ZVigC4fn+H9UL5Hqa+psaWOFT0QOXDFW1kJfg+TPn9HgH 8xYm8k2oApSia+3Ah11iomxMhNjmmdgqQD+0qr6xwQ== X-Google-Smtp-Source: APiQypJfYroSpUCijE7NT8CwDAFyHfYstWDtNFy+8zQKAaZ5mVlff6Oh6UVuV+5ypAgPsfDkiWUfb8cx/j5R/Atk7pw= X-Received: by 2002:a67:334a:: with SMTP id z71mr1336333vsz.87.1588290214794; Thu, 30 Apr 2020 16:43:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 1 May 2020 00:43:23 +0100 Message-ID: To: Lynn Cc: Bob Weinand , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Mixed type From: Danack@basereality.com (Dan Ackroyd) Bob Weinand wrote: > Mixed is a hack, do not use mixed. > ... > As such the introduction of mixed is pretty much necessary. > I'm actually in favor of introducing it. Matthew Brown wrote: > I'm opposed to the use mixed in codebases ... > A type system without an explicit mixed type feels incomplete to me. 'I am agree with all'. Mixed is a vital thing....that should be used as little as possible. Marco Pivetta wrote: > I think making `mixed` very painful to write may be a big advantage. Everything is a tradeoff, and I think one of the things that PHP does well right is allowing people to choose their own tradeoffs, rather than having a "one true way" of doing things in PHP. Exceptions, eval(), annotations/attributes, and the mixed type are all things that have a vital place, even though they can be used inappropriately. Making something like this painful to use seems a bad choice. It's different from things like json_last_error() or preg_last_error() where doing the easier thing (of not checking those) is always the wrong thing. In particular for people like: Lynn wrote: > I maintain lots of legacy code and I cannot add > return types despite being truly mixed. Mixed is not a > hack, it's a scenario that frequently happens. making things more painful for people maintaining legacy code seems like definitely a bad choice. Gabriel Caruso wrote: > Has the type `any` been considered? Yes. I think mixed is the better choice for now. There's just so much widespread use of 'mixed' in PHP core, extensions, documentation and userland code that even if 'any' were a slightly better choice long term, taking a choice that would probably be multiple years before it paid off it's cost, seems bad. Ilija Tovilo wrote: > One note: I was wondering if the following > code throws an error (it does): Thanks, updated the RFC. cheers Dan Ack