Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106582 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 50151 invoked from network); 14 Aug 2019 11:32:55 -0000 Received: from unknown (HELO mail-wm1-f42.google.com) (209.85.128.42) by pb1.pair.com with SMTP; 14 Aug 2019 11:32:55 -0000 Received: by mail-wm1-f42.google.com with SMTP id v19so3743628wmj.5 for ; Wed, 14 Aug 2019 02:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Y5d/O8DCEllzz1WAtJFyciewIVyV3UcTKuRIZdn++Jo=; b=HnCe5DF9awfMhB7DNJ4o3/I5fhrCe8ccEzCU7gFrt66HiTvs0zIg5gCvsV0u6fq10W d7CBYY30GNiKWQeMVuVo++j8uOxHnok7hxlnGyc5UkCcaQ3IMMNqOtGsnZcogaiF9e2I WTFHCckwW+/42DDSA/9oEOglYWq/RtUtVizzauXgcSZwJ6C6a1Ql0DR4yxU/sdyhbdKn XvhdVutjNS2c7jH+wU1e+kEznowNV/lDhN1ODOTr0VXD1rwEG2tyL3AGfcJJ4EIkp0lV XIfeAcTNcuo5HfotXS1vXoplBteT3rg3pV7vpKagrIUNFSGBPhmmiVoC75t6t29IsGvk luYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Y5d/O8DCEllzz1WAtJFyciewIVyV3UcTKuRIZdn++Jo=; b=ID2S+5nbYihc/k1LTWpqjwQFegB38NhEBol7UoI7BcDqutRSl0quTPQepzyZ6e8Ss3 bCjtyfS/CRCK41cnOuqq+F5exDSb2zH+tkEb6jltCkN0pYJR7BcYOjmHuvzKV0tOXcfH 9CuF3/fGuWrIWzwxA2MAjbVCkJCot5vbGk4SzLJqCj3bMwCFSjdKI7q0gbNokZ4Pmzcd xRNY9wn6eWKvjAVvYSGO0sQw5uaegFHI1aGMB12xfNpWSSlzVYa13GplxfadVBSeedGY f0dtkDJ+y0LFQKn4ohzA0Wfn5V8TXbVCk0ukr51o7XyqReyDrxdiI69giUt4kX8+11Nm APZQ== X-Gm-Message-State: APjAAAXYsANQrwxf/CaT9gfauXxdxC6JxEtUgikyb1JXWWZTSxG06526 Atv7B2O+k4Z5kMCSggrQv9tl2t// X-Google-Smtp-Source: APXvYqw7iX3iKMJe3ICYYG55g3941KJShDo01lSKYV4EDCIuRuBOlN6Lr3JiuIX02Gg12LWMFiXTOw== X-Received: by 2002:a1c:a8d7:: with SMTP id r206mr7355550wme.47.1565773290445; Wed, 14 Aug 2019 02:01:30 -0700 (PDT) Received: from [192.168.0.16] (cpc84253-brig22-2-0-cust114.3-3.cable.virginm.net. [81.108.141.115]) by smtp.googlemail.com with ESMTPSA id b3sm24310407wrm.72.2019.08.14.02.01.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Aug 2019 02:01:29 -0700 (PDT) To: internals@lists.php.net References: <25d774e8-183b-d39c-4ac4-81c1b7770229@gmail.com> <5d5298a5.1c69fb81.b4ed1.2d97SMTPIN_ADDED_MISSING@mx.google.com> <3db68c5e-54d1-812f-bbf5-1b089cba1bff@gmail.com> <5d52f72d.1c69fb81.8f95f.57a1SMTPIN_ADDED_MISSING@mx.google.com> <2bcb05d6-abf6-4fcb-599e-eaf4bcd58878@gmail.com> Message-ID: <182a6bd5-4057-7ba1-2cca-ab0be37e0b75@gmail.com> Date: Wed, 14 Aug 2019 10:01:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] Namespace-scoped declares, again From: rowan.collins@gmail.com (Rowan Collins) On 14/08/2019 07:45, Michał Brzuchalski wrote: > It doesn't have to be a new syntax if we agree to put package definiction > in sort of separate configuration file. With the exception of INI files, all your examples are new syntax, as far as the internal mechanisms in PHP are concerned. They have the advantage of not inventing our own, but the disadvantage of needing our parser to handle all the ways people might write them (particularly true for YAML). > That way it would prevent to mix normal PHP code with package definition, > cause every possible PHP syntax > we would agree, opens the door to add something more to that file, for eg.: > > # package.php > declare package MyVendor\MyLibrary { > strict_types = 1, > encoding = "UTF-8" > } > function foo() {} I don't see this as a problem. Right now, PHP doesn't care how many files you put your code in. As far as I know, you could concatenate the entirety of Laravel into one PHP file, and applications would not be able to tell the difference. Similarly, you could put the whole thing in a database and use eval() to execute it without touching any files. In the same way, we can have a package definition not as a configuration file, but as a piece of PHP code that needs to have been executed. In practice, people wouldn't write what you have there for the same reason they don't write this: # foo.php 1,        'strict_operators' => 1     ]; } That way, we can probably reuse the whole parser infrastructure, and it looks entirely natural to a PHP programmer. [1]: https://blog.jetbrains.com/phpstorm/2019/02/new-phpstorm-meta-php-features/ -- Rowan Collins [IMSoP]