Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106841 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27287 invoked from network); 4 Sep 2019 08:38:50 -0000 Received: from unknown (HELO mail-ot1-f42.google.com) (209.85.210.42) by pb1.pair.com with SMTP; 4 Sep 2019 08:38:50 -0000 Received: by mail-ot1-f42.google.com with SMTP id r20so19468190ota.5 for ; Tue, 03 Sep 2019 23:12:40 -0700 (PDT) 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=NqsLusnCPGfyWYgVEp94Wpg9dJU5ToBmdM3MmRA8IYU=; b=g6QRenWQWzLHBr85XRVc/FDKBhC6+y10AmaQZDa81+4EUS+AW+arTqNRD1XHuHrgHw 8/iSgmYL9RC5eEQc+RcNUshNkDpOhq7uV6XpXo0rYN0Cot4Q0OSQdoqKrZVP/ByCZAqf y0OGCqkp7sI/XEHMno0OyD3uoodSSBeKFPiAhD+U8cxk+LlKHYpRXvsMOTnc/Su3eqFP TBYKjb2FlSqfwdJ5iZWje/irmMwrJCra9KkjreiP8tCk6BZZQakZRPPuCpBg9YyredDW UZ/2YUu8mCO7d7RqSm17Lz+RQ99c7YRJQ5cWOJkIcgYhUDkqMsYv6FyGNi1H6yTyUNCc TT2w== 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=NqsLusnCPGfyWYgVEp94Wpg9dJU5ToBmdM3MmRA8IYU=; b=XbVAK+ebI//rLFSmyxjJkbLvEdwYBR466Cnrz5f6Qqzi2FZG3+l3w9CiM/Y6JzcqCx Vu5mCPoiriVt5hJkOogGKpvX8sHPxBe07ebYLImOP+HiJ84hhEK72CK881BevSRdPVwU XJsy8rJXeEi8jZwgJP12cXa8Du02pSvVizBodUtLcKJA5GqVFmBumR1Dy+TqQ23K9Xrg JWj5rqnvGkdFR/E7pPTwCXApuD0I9c3e/RNuoRCN1q8aW6EnLURNetkjt5/ernCQ2YWQ qxPX7Z4USAeE59uyJ8AAzqRxB/7/fGQfuC9ywbgvX0Zp0cPd86DBbDbW4Qm7W/T3rmRs GVDQ== X-Gm-Message-State: APjAAAVrVMLK21Svs5cACDzBrtf4iDhpV69MpfIggVftttTx7VhCSs9D iaU4hIxX0i56V2ngH9VhVr+fQdSB4RukokjefHQ= X-Google-Smtp-Source: APXvYqxdmCMfwK1tZFLlmeW7NTE5cWFnEe3jtIiq8WJ7ywZgODjajupDgYWkxs1eclEt04R9X9AEWbFLGkJe+BrKk4Q= X-Received: by 2002:a05:6830:1687:: with SMTP id k7mr18753671otr.258.1567577560220; Tue, 03 Sep 2019 23:12:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 4 Sep 2019 08:12:27 +0200 Message-ID: To: Fwentish Aelondes Cc: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000a297ee0591b41708" Subject: Re: [PHP-DEV] Silent Types From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --000000000000a297ee0591b41708 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =C5=9Br., 4 wrz 2019, 05:52 u=C5=BCytkownik Fwentish Aelondes napisa=C5=82: > Hello internals, > > Zeev's idea to bring peace to the galaxy seems like a good idea, but > impossible to implement in practice. > > But it got me thinking about how one might introduce static typing > into a dynamically typed language w/out breaking BC. > > And then I had this crazy idea: > > //int > $i =3D 0; > > //string > $c =3D 'c'; > > //float > $pi =3D 3.14; > > If static typing in php was *only* an opt-in kind-of-thing, would this > work? Could the parser be built to identify 3 or 4 different keywords > in comments and give warnings or fatal errors for type conversions of > variables that have the type specified in the immediately preceding > comment? > > Just a (crazy) idea. > > ---- Fwentish IMO it's crazy idea and we should not change the way comments work especially inline comments which even aren't kept in opcache. I think better approach would be to put type in front of first variable declaration like: [type] $variable =3D $value; BR, -- Micha=C5=82 Brzuchalski --000000000000a297ee0591b41708--