Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101518 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58113 invoked from network); 3 Jan 2018 17:54:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2018 17:54:52 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.182 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.161.182 mail-yw0-f182.google.com Received: from [209.85.161.182] ([209.85.161.182:36168] helo=mail-yw0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/C2-23177-AE81D4A5 for ; Wed, 03 Jan 2018 12:54:51 -0500 Received: by mail-yw0-f182.google.com with SMTP id r205so836390ywb.3 for ; Wed, 03 Jan 2018 09:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=1bDGcPAE4VqHrGI/4aV6usGEaGZ8r6rkpGhMr26I2rE=; b=f6++zI1Mai/tVlM+Ipzx7z9ZcdsbE/e4Jwaxt9v4d/bicwcwOuYGYCzOy9rsiukvT9 RuRzfJizRWH5C67n1+p9vn8SA5uY9MYdiv4ALTzAdD/F35yxTIE5a+WJHvgLSKbLF/dN mnfAjg0IE+SRgF9m39qjld+D9A7100KEHZMpIFMa+btGjRE126dveHUeCcs9Vr6I1TkW Mf+2kh92THqnlG1+eDG42Yja0oiteEo/2UpBdja69hp0/kAjKrZoKjEvXwO0plmbUYU2 AE5gqYBXAuIVs+ZfAHb5gaUznq4FzHrYhqR6juxMvOk5EoCnGpl/4HEp2NQlxNrF1QBy a6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=1bDGcPAE4VqHrGI/4aV6usGEaGZ8r6rkpGhMr26I2rE=; b=mXOMEXyniOJqTYTsYOiuoPWMAVcf3f145/Ohq4I7OuiykDNQj4vkAFjqLdUxkJ9G2b +NB2O1SUOhtRzlKh2X61Tyb1mXga2FJWlRVS9flceZr8O1gh3k5KqgdK1eHeeQ/+khaL SHlFruTC/nQn0zQs6ID3L3js2tZNF21Dlf8ObEewQNH8qu1jsYkXkRPRfUo+d3mXZ1TL 2ItGpTBMh4rRys8upwDdVUwBafk/jVj1haQL8iK+s1PLggrH93ZqlCro+hPqUvywaGqQ ekIbdxsV1GxfDppzyQNWkEPAMgAvyQOhSKjdnTHh/7BAWM0X5qj8yVjx8CKceoR3lygI g+OA== X-Gm-Message-State: AKGB3mIFHno+f8LfFs3fQC0qlm4W4xD9Z8OqdSpyASDTu4MuhRQ/50Qi YndlBif37MgrYfMdzL/+e8MACfCPScIn1CEHNgE= X-Google-Smtp-Source: ACJfBos/JginjgkO1YX6JHJ09EZKIgKG4yCQiBmY7Lh5FWpFUmP4jxdRmiP8CNG2phHBE/q258ROjgskEKRML6YAjgk= X-Received: by 10.129.128.69 with SMTP id q66mr2022216ywf.81.1515002088150; Wed, 03 Jan 2018 09:54:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.201.7 with HTTP; Wed, 3 Jan 2018 09:54:47 -0800 (PST) In-Reply-To: References: Date: Wed, 3 Jan 2018 12:54:47 -0500 Message-ID: To: Andreas Hennings Cc: Niklas Keller , PHP internals Content-Type: multipart/alternative; boundary="94eb2c030b644c5a4a0561e2e9aa" Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Strong Typing Syntax From: tendoaki@gmail.com (Michael Morris) --94eb2c030b644c5a4a0561e2e9aa Content-Type: text/plain; charset="UTF-8" On Wed, Jan 3, 2018 at 12:21 PM, Andreas Hennings wrote: > Another idea I have when reading this proposal is "implicit" typing > based on the initialization. > > E.g. > > $x = 5; > $x = 'hello'; // -> Error: $x was initialized as integer, and cannot > hold a string. > > No, no no. I don't think I'd like that always on approach. However, I just had an idea..... Let's step back. Way back. PHP/FF days back. Back in the day Ramus chose to put variables off on their own symbol table for performance reasons. This isn't as necessary now, but vars in PHP continue to be always $something. Now I don't know the implementation can of worms this would touch but what if this was changed for the locked type variables. That would distinguish them greatly.. int x = 5; Here x is a locked type variable of the integer type. Since it's also on the same symbol tables as the classes, functions, constants et al I presume it is namespace bound as well. var x = 5; If allowed what would this mean? And what to do with class members is an open question. Anyway, I'm looking for an implementation that allows loose and strong typing to coexist even within a given file. I use loosely typed variables most of time myself. --94eb2c030b644c5a4a0561e2e9aa--