Hello Dmitry,
Tuesday, August 5, 2008, 1:28:32 PM, you wrote:
> Of course not, but it will be very hard to understand difference and
> fix parser conflicts.
How is that hard? we have top_statement and inner_statement in our
parser...problem solved.
Ha, i actually just learned this way that we support inner functions, tsk.
marcus
> Thanks. Dmitry.
> Marcus Boerger wrote:
>> Hello Dmitry,
>>
>> Tuesday, August 5, 2008, 8:38:07 AM, you wrote:
>>
>>> Allowing "use" inside function body assuming allowing it everywhere.
>>
>>> $x = function($arg) {
>>> if ($arg) {
>>> use $a;
>>> } else {
>>> use $b;
>>> }
>>> };
>>
>>> I don't like such ability and of course we won't be able to use "use"
>>> keyword as it will conflict with import statement.
>>
>> So the import statement use can be placed inside the body of a function as
>> an expression?
>>
>>
>>> Moriyoshi Koizumi wrote:
>>>> Dmitry Stogov wrote:
>>>>>
>>>>> Marcus Boerger wrote:
>>>>>> Hello Dmitry,
>>>>>>
>>>>>> Monday, August 4, 2008, 8:55:00 AM, you wrote:
>>>>>>
>>>>>>> Hi Marcus,
>>>>>>> see below
>>>>>>> Marcus Boerger wrote:
>>>>>>>> Hello Internals,
>>>>>>>>
>>>>>>>> please let's not introduce new inconsistencies. Rather lets make new
>>>>>>>> stuff consistent with old stuff during the alpha phase of 5.3.
>>>>>>>>
>>>>>>>> 1) new keyword 'use'. Semantically it is the same as 'static' or
>>>>>>>> 'global'
>>>>>>>> so it should be used in the same location.
>>>>>>> For me 'use' is the best keyword as it says that closure uses
>>>>>>> variables from current content. (the same keyword is used for import
>>>>>>> from namespaces)
>>>>>> To be clear, I wasn't complaining about the keyword per se. I just
>>>>>> prefer
>>>>>> it to be inside the curly braces of a closure next to global rather
>>>>>> than in
>>>>>> front of it.
>>>>>>
>>>>> No. The list of lexical variables is a part of the closure definition.
>>>>>
>>>>> The earlier implementation had "lexical" keyword which worked as you
>>>>> are suggesting, but it was much unclear.
>>>> I don't think there are many differences in ambiguity between
>>>>
>>>> $closure = function ($arg) { use $a;
>>>> ...
>>>> };
>>>>
>>>> and
>>>>
>>>> $closure = function ($arg) use ($a) {
>>>> };
>>>>
>>>> Moriyoshi
>>>>
>>
>>
>>
>>
>> Best regards,
>> Marcus
>>
Best regards,
Marcus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php