Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106860 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73254 invoked from network); 4 Sep 2019 20:27:44 -0000 Received: from unknown (HELO mail-pg1-f174.google.com) (209.85.215.174) by pb1.pair.com with SMTP; 4 Sep 2019 20:27:44 -0000 Received: by mail-pg1-f174.google.com with SMTP id p3so11632009pgb.9 for ; Wed, 04 Sep 2019 11:01:41 -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=UZsChaYMBnr1CcYG0tGS2umvgNYcKH4aDA7MvzflJs8=; b=kVo3WYT+JqE3EjNQGfFjj83O3GKwfSywh5nr8V1APzrtWpaY5ahJkiYBIu8beaJdYa ykdFq4W+oD7UmoNGJMbVp+jvWC2iCCcwMnC6d0vWn22HVU/iFI+sihmJkWE9mkjRPhZa 0HMWDSK4YDT1A3NSCFT9K8ePViUPf28YsMRWijFYyi0pzLwzT9yI63dOfqjdGHDKSunH EmmIyss7HJKHYoZyk6nOo5PU/AQJkKY7xUI4HzZ9M3FkU8gww4KUsgnfF4OKjiNrDekt slyMGGSSNO2uIk6d4Fz1XeYnUkX06O9n2Y0HkYzy9DIXy11cSEXXocHKbm7Wbrbmk8/w ji8A== 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=UZsChaYMBnr1CcYG0tGS2umvgNYcKH4aDA7MvzflJs8=; b=bpuqcp9j1Odz65agNsnymon5FxTx6J4KWw8IOJ+47CWfeQu8D3YJrCa/DAbZjHDHkz 3WpZOSLeyrFWA+eZ0HUOP2I9hmj8mofO+gIECPkolv0TKFCSqw1mR+kf6q94v2vUvhiD EwFFx89KjFJIXzXCHhTwocqNGP4N1p8gE3WXn2Gpl4L+GyBz5Dnf9yxouwbP7FtcNQVL dvXrtalTSwPG7E3Xsm9rLhjuq1aEOhUc3de/JEfN+r40JTx/ZapJpCnv65EVpk8ckcmq AYBcX/rJlttgcRaoeTVZku9U00VA0etwJj35eyCP9PhnRWL/8YrTKpD7LAFyRSQRNXqJ 6NOA== X-Gm-Message-State: APjAAAWuZ7+rCIFv1TVM6iyPWjApXMgtGxill32KFsFmcLMpZsyWTq2J pbgQyrcY6e6539c9amwtNWG8GRHaVlztbbJNOeI= X-Google-Smtp-Source: APXvYqzPElJ1bxfW3TZe6gF/bCAPTpOSGeTBZJadwrE2PcJr5+k72NpwT+epFeLSx5KsMXoQniLG0Pnt99cHZ/YCCsw= X-Received: by 2002:a62:c102:: with SMTP id i2mr10253332pfg.7.1567620100951; Wed, 04 Sep 2019 11:01:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 4 Sep 2019 11:01:30 -0700 Message-ID: To: Andreas Hennings Cc: Lynn , =?UTF-8?Q?Micha=C5=82_Brzuchalski?= , Fwentish Aelondes , PHP Internals List Content-Type: multipart/alternative; boundary="0000000000004291ae0591bdff1c" Subject: Re: [PHP-DEV] Silent Types From: mo.mu.wss@gmail.com ("M. W. Moe") --0000000000004291ae0591bdff1c Content-Type: text/plain; charset="UTF-8" Hello, this would be very possible constant with the actual without breaking BC allow declare var = value : type; -> throws if assignment + type fails the grammar context is exactly the same than a function return. Best. On Wed, Sep 4, 2019 at 10:18 AM Andreas Hennings wrote: > On Wed, 4 Sep 2019 at 09:22, Lynn wrote: > > > > Note that this behavior would require making some decisions whether or > not > > in the future this opt-in behavior should change when a default value is > > given, such as with C# and type inference when declaring a variable, > based > > on its assigned value. > > I think this would too easily lead to mistakes. > E.g. if in a git commit, "$x = 5.6;" is replaced with "$x = 5;" or "$x > = '5.6';", then would a reviewer notice that this implicitly changes > the type? > Also, what if the initialization is inside an if branch? Later the > if/else gets reordered, or one of the conditional branches gets > removed, and the variable changes its type? > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --0000000000004291ae0591bdff1c--