Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
Hi, Internals, Thanks, Marco and also to Rowans, Josh, David and Tyson I'll use IIFE in order to avoid global conflicts. Regards En lun, 10 ago 2020 02:16:06 +0200 Marco Pivetta escribió > Hey Manuel, > > > > > On Sun, Aug 9, 2020, 11:02 Manuel Canga wrote: > > > Hi

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Marco Pivetta
Hey Manuel, On Sun, Aug 9, 2020, 11:02 Manuel Canga wrote: > Hi Internals, > > I'd like to open up a discussion around the implementation of a new > functionality: 'import of variables'. > > This functionality would allow to create a new 'use vars' keyword in > order to can use( or cannot us

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
-- Manuel Canga En dom, 09 ago 2020 23:41:12 +0200 Rowan Tommins escribió > On 9 August 2020 22:35:11 BST, Manuel Canga wrote: > > Hi Manuel, > > I think there's a misunderstanding. My comments weren't really about how to > implement your proposal, they were about the fea

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
Hi, David. Thanks En dom, 09 ago 2020 16:58:41 +0200 David Rodrigues escribió > I suggests to make something like Node does: import "file.php" ($a, $b) so > $a and $b must be extracted from file.php context. All other variables > should be ignored. > Or, to avoid create more com

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
Hi, Josh. Thanks En dom, 09 ago 2020 21:36:30 +0200 Josh Bruce escribió > Have not tested - just catching up on emails. > > To verify: A property defined with a default value of the global does not > already do this? In functions/methods. In some files can "inherit" gobal vars

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
Hi, Tyson, Thanks. En dom, 09 ago 2020 16:41:44 +0200 tyson andre escribió > Hi Internals, > > To be clear: The variables in the top-level scope depend on what has > require()d/include()d a file. > The top-level scope starts off as being global, but if a file is required >

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Rowan Tommins
On 9 August 2020 22:35:11 BST, Manuel Canga wrote: >I don't know about internal C PHP, but could it be implemented as... Hi Manuel, I think there's a misunderstanding. My comments weren't really about how to implement your proposal, they were about the features the language already has, which

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Josh Bruce
Have not tested - just catching up on emails. To verify: A property defined with a default value of the global does not already do this? Developer need: I rarely access global variables directly - usually going through a lib or framework. When I do I would probably wrap the access in a trait o

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread David Rodrigues
I suggests to make something like Node does: import "file.php" ($a, $b) so $a and $b must be extracted from file.php context. All other variables should be ignored. Or, to avoid create more complexity and possible new keywords to import syntax, maybe create a new function: importx(string $file, ?

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread tyson andre
Hi Internals, > This functionality would allow to create a new  'use vars' keyword in order > to can use( or cannot use )  global variables in local scope( of current file > ). To be clear: The variables in the top-level scope depend on what has require()d/include()d a file. The top-level scop

Re: [PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Rowan Tommins
On 09/08/2020 10:01, Manuel Canga wrote: Hi Internals, I'd like to open up a discussion around the implementation of a new functionality: 'import of variables'. This functionality would allow to create a new 'use vars' keyword in order to can use( or cannot use ) global variables in local sc

[PHP-DEV] [RFC] Import of variables

2020-08-09 Thread Manuel Canga
Hi Internals, I'd like to open up a discussion around the implementation of a new functionality: 'import of variables'. This functionality would allow to create a new 'use vars' keyword in order to can use( or cannot use ) global variables in local scope( of current file ). I think the best i