Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103799 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14288 invoked from network); 23 Jan 2019 18:05:28 -0000 Received: from unknown (HELO mail-ed1-f49.google.com) (209.85.208.49) by pb1.pair.com with SMTP; 23 Jan 2019 18:05:28 -0000 Received: by mail-ed1-f49.google.com with SMTP id f9so1870995eds.10 for ; Wed, 23 Jan 2019 06:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MlSHGMQippsO5xnuCbAyMPOz/JFtFLXkOEfCIC5PhuQ=; b=Kv8ta+JN41LD7ls5riUJe0+PPdbaxA91Oz9xPBb/xmBeM2fFIJ6ylsIQum0ZNaa6PO Z5kU0ivczpLjG4lzsN33Op43dT72ZpGd/PeAyjBm40FiDzxhhDUquBLfTZ8EQTqYEJUg yAI3DVceNODm/9RaPRI809YPgZb6V9MahJly+v335ZW3UbsiHjMWtlErzxbDCT7YGGai 2zCH7M943jx1QnD/m7tramdOzmgPo+RY/SN0FDLLYKHgSTY2azZ5fXjWPwMs9jKLTM8J sX2XcCuvWwLUsj7unYdQL4+UcqERZbh9+alK+ZpEngdIuKlorf17CXDCH1KH20YXKd+Y CuLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MlSHGMQippsO5xnuCbAyMPOz/JFtFLXkOEfCIC5PhuQ=; b=pG6yVG8oZJZ4wQ42bx6nP2Oel2DzOEijKip7GeOEepQDJYAVl4jwAZmqabF16mz3i2 wL+kZ5BYC2PXAScsFHGx1iVfr4sS2mF44QG75pUZ3mhwGJtjs5B43dZzwujXVeZA2zl5 zY0tbAxj0D5CrD8C50+GKZCXCj7GxRocgKk3Ywl5Y7/19KkAEwiq0ChCtKtvyGH6tG7t VIwZ0RnsAVAQgNi1UUmUIgKH0cUHz6tEp3iOFx/TTHKOjDRnT4ZUfuXRSmDqokkes57/ ZORK9MVdJQAJJ9ftGp9muL6oLjJbw/F2N5jDEMNKZOZa56wf0XPeKz6dEWm19PoYrCIF XkUg== X-Gm-Message-State: AJcUukfjVigh+8Ty5TcMgGWIJ/eN2zwCUYQ4s/aY2WG5H+qYRxTjisQQ 2dU3mfn6aQMOa+kCiDG0TkI= X-Google-Smtp-Source: ALg8bN4ke+zcC/S1b/BmBwrB7FpJM4uLFgy1RYzTfJsno/aKsUY1+9DjeHDJxpZs3HK3TkM4zk69RA== X-Received: by 2002:a50:b14c:: with SMTP id l12mr3014812edd.139.1548254602043; Wed, 23 Jan 2019 06:43:22 -0800 (PST) Received: from [192.168.0.63] (84-75-30-51.dclient.hispeed.ch. [84.75.30.51]) by smtp.gmail.com with ESMTPSA id a27sm10969905eda.65.2019.01.23.06.43.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 06:43:21 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) In-Reply-To: Date: Wed, 23 Jan 2019 15:43:20 +0100 Cc: Arvids Godjuks , Jani Ollikainen , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Girgias X-Mailer: Apple Mail (2.3445.102.3) Subject: Re: [PHP-DEV] Deprecation ideas for PHP 8 From: claude.pache@gmail.com (Claude Pache) > Le 23 janv. 2019 =C3=A0 14:19, Girgias a = =C3=A9crit : >=20 >=20 >=20 > On Wed, 23 Jan 2019 at 09:19, Claude Pache = wrote: >=20 >>=20 >>> - settype >>=20 >> AFAICS, there is no easy replacement for settype(). If the second = argument >> is a string literal, you can use type coercion + assignment at the = price of >> duplicating the occurrence of the first argument. If the second = argument is >> not known at compile time, you have to resort to a switch statement = or >> something similar. >>=20 >=20 > I did not consider that someone might want to set the type of a = variable at > runtime because > I can not see any pratical usages for that, imho you change a variable = type > into another one > because you want to work with that specific type. But it basically = boils > down to the same issue > as with gettype that without it you need to do a switch statement to = get > something similar. >=20 >=20 So, since you didn=E2=80=99t see, here are some practical usages of = settype(): Here are a usage of settype() with a non-constant second parameter: = Define a utility function that cast a value to a given type when it is = not null: Sure, one can avoid settype() and do it the complicated way, but why? = What is the issue with settype(), so that you want to deprecate it? =E2=80=94Claude