Synergy.
Why should this be done?. Because someone can read my purpose and can modify to
something better, maybe a great change to the language.
I think so.
Regards,
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
on wasn't a closed purpose. Maybe ``` is not a good syntax, In this
case, other can be found.
Regards
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
essage/115213
ups!, I'm sorry...but, look at:
https://externals.io/message/115213#115222
Markdown is not broken here due to ``` of code.
Regards,
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
backticks.
Although these examples work generally, with some Markdown parser can that
these doesn't work.
Maybe other syntax could be used, but I don't know which. In javascript only a
backtick is used:
https://developers.google.com/web/updates/2015/01/ES6-Template-Strings . But in
P
mething, your proposed syntax would just be a *more
> verbose* way of writing single quotes.
Hi, Rowan,
Basically, you're right. This would be a Heredoc variant of writing text
without worrying about quotes (singles or doubles). Something like:
$quote =```"Sometimes it
ll:
$string =```Link: '%s'```;
I see a caveat: this is very similar to `eval` syntax. However, this syntax is
more similar to Markdown syntax.
What do you think ?
Regards
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
-
> Guilliam Xavier
>
Hi, Guilliam,
I think so.
I don't need `dirname` function in order to extract path from a file name.
However, `dirname` exists in order to simplify a "common" task in a semantic
way.
Why don't the same with namespaces ?. There is
is useful.
do we avoid "dangerous" features ? or do we think people are professional( I
don't know if this is used in English equal Spanish ) and they know using it
when is needed ?
I think that if something is common and normally useful, PHP should implement
that. For example,
#x27;, '/', get_namespace( $ful_class_name ) );
$class_name = strtolower( get_base_namespace( $ful_class_name ) );
require "{$class_path}/class-{$class_name}.php";
}```
[1]: https://www.php.net/manual/es/function.dirname.php
[2]: https://www.php.net/manual/es/function.basename.php
Reg
az\B::getNamespace(), PHP_EOL;// Foo\Bar Ho no !```
> Unfortunately it doesn't work ...
>
> Best regards,Serge
>
Hola, Glash,
I sometimes use:
class Foo {
const NAMESPACE = __NAMESPACE__;
}
Foo::NAMESPACE;
However, this doesn't work:
class Bar extends Foo {
I'm Sorry, I feel a little nervous by writing here again after long time.
Replace '/' by '\' and PATH( HELPER_PATH | SERVICE_PATH ) by NAMESPACE(
HELPER_NAMESPACE | SERVICE_NAMESPACE ).
Sorry
En vie, 26 feb 2021 09:16:18 +0100 Manuel Canga
escrib
uot;/{$serviceClass}";
return new $serviceClassName();
}
}
use MyProject\MyModule;
class Controller {
public function __invoke() {
//..
$date = $this->instanceHelper('Date');
//...
}
}
```
[1]: https://en.wikipedia.org/wiki/Fact
--
Manuel Canga
Zend Certified PHP Engineer
Websites: https://manuelcanga.dev | https://trasweb.net
Linkedin: https://es.linkedin.com/in/manuelcanga
En jue, 25 feb 2021 23:12:23 +0100 David Gebler
escribió
> You can achieve what you're trying to do already with a combin
En jue, 25 feb 2021 21:41:40 +0100 Nikita Popov
escribió
> On Thu, Feb 25, 2021 at 8:11 PM Manuel Canga wrote:
>
> > Hi internals,
> >
> > I would like to present a possible new RFC( "class_name:namespace" ) for
> > your consideratio
se examples are ways for getting a thing which PHP compiler would
resolver fast.
It would be fantastic can code:
MyClass::namespace or static::namespace( for example, in abstract classes )
Don't you think the same ?
Regards
--
Manuel Canga
Zend Certified PHP Engineer
Websites: https://m
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 Ca
--
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 p
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
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
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
>
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
#x27; => 'int');
$is_valid = array_check_scheme( $request, $scheme );
```
> e.g. to write `?string $foo = 'hello'` rather than `'foo' =>
> ['type'=>'string', 'nullable'=>true, 'default'=>'hello']`
#x27;Nikita', 'surname' => 'Popov' ] ); //is_vaild = true
my_function( ['name' = 'Nikita'] ); //is_vaild = false
my_function( ['name' = 'Nikita'], 'age' => 10 ); //is_vaild = false
A function like this could be useful in other contexts as well.
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php
En mar, 19 may 2020 08:53:46 +0200 Manuel Canga
escribió
>
> Hi, Internals,
>
>
>
> En dom, 17 may 2020 06:33:51 +0200 Peter Stalman
> escribió
> > A few thoughts:
> >
> >
> > 1. I agree with th
tuff */
}
`escape when( expr )` returns value of `expr` to caller function when
`expr` evaluate to true otherwise next line.
function main_function()
{
escape with $ a + 1 when( !calculate($var) );
/* do other important stuff */
}
`escape with expr1 when( expr2 )` returns value of `expr1` to caller function
when `expr2` evaluate to true otherwise next line.
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
ve already read your thread. I like your purpose about "Explicit
call-site send-by-ref syntax". I don't understand why it wasn't accepted.
Yes, you're right about performance then maybe this RFC doesn't make much
sense. :(
Thanks, anyway. You can remove my karma again.
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Hi, Nikita and internals,
En lun, 11 may 2020 11:34:22 +0200 Nikita Popov
escribió
> On Fri, May 8, 2020 at 8:49 AM Manuel Canga wrote to
> this RFC, could someone give me(manuelcanga user ) karma in order to create
> wiki page ?.
>
> I'm finding it ha
En vie, 08 may 2020 23:40:22 +0200 Bob Weinand
escribió
> > Am 04.05.2020 um 10:53 schrieb Manuel Canga :
> >
> > Hi internals,
> >
> >
> >
> > I would like to present a possible new RFC( "keep type of reference
llow explicit call-site pass-by-reference annotation.
Then, current references are deprecated and after than, in other version, they
are removed.
In this way, projects can be adapted gradually
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
En vie, 08 may 2020 15:07:13 +0200 Dan Ackroyd
escribió
> On Fri, 8 May 2020 at 07:49, Manuel Canga wrote:
> >
> > What is your opinion ? Do you see it useful ?
>
> I can see the need; I strongly dislike the idea of using references for this.
>
e( and me ) I know, normally
use local vars for function calls.
Thanks Thomas for your opinion.
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
sidering this a pipe
dream.
But I'd gladly be shown otherwise.
Hi, George. Thanks for your opinion.
Nikita porposed a RFC in order to improve refences(
https://wiki.php.net/rfc/explicit_send_by_ref, links thanks to Rowan ).
Maybe, he wants to code this.
Regards
--
Manuel Canga,
En lun, 04 may 2020 19:33:51 +0200 Rowan Tommins
escribió
> On 04/05/2020 16:43, Manuel Canga wrote:
> > I think I’d be positive of adding `inout` keyword in order to:
> >
> > - Check type of out is equal to type of param( like example of my first
>
first email ).
- Avoid modifying caller var value when the function throws an exception
Other option is adding to normal reference( & ) these behaviours when
strict_types will be activated in caller.
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To u
Hi internals,
I would like to present a possible new RFC( "keep type of reference params" )
for your
consideration.
Firstly, an example:
```
> foreach ($arr as $i) {
> > foreach (make_res($i) as $v) {
> > $res[] = $v;
> > }
> > }
> >
Maybe, PHP needs array_flatten like Ruby:
https://apidock.com/ruby/Array/flatten
In this way, above code would be equal to:
$res = array_flatten( array_map('
e] = array_map('intval', ["now" => "2020",
"name" => "2021"] );
If I were you I add examples with mixed types, like:
["address" => (string) $address, "floor" => (int) $floor] = ["address" => "My
adress", "floor" => "3"];
I'm sorry my English
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
his->foo($bar) switch {
> 1 => 'hello',
> 2 => 'hi',
> 3 => 'goodbye'
> };
In this case, you can also do:
$result = [
1 => 'hello',
2 => 'hi',
3 => 'goodbye'
][$this->fo
; >
> > 4. Don't allow catching exits at all. In this case the exception is just
> > an implementation detail.
> >
>
> I've started implementing variant 4 in
> https://github.com/php/php-src/pull/5243. It uses an internal exception
> type to implement exit() that cannot be caught.
>
> Finally blocks do get executed, as they should be. This does mean that it
> is possibly to discard the exit through finally, because control flow
> performed in finally always wins:
>
> try {
> exit;
> } finally {
> (null)->method(); // throw Error
> }
>
> This snippet will throw an Error exception, with the original exit being
> discarded.
>
> try {
> try {
> exit;
> } finally {
> (null)->method(); // throw Error
> }
> } catch (Error $e) {
> // Ignore
> }
>
> This snippet will catch the Error exception and thus stops unwinding.
>
> I believe this behavior is correct and expected (by which I mean:
> consistent with finally semantics), but it does mean that exits can be
> discarded even without having an explicit "catch_exit" function or similar.
>
> Nikita
>
Hello,
About this subject:
Nowadays, `register_shutdown_function`* function exists in order to custom your
the end of program. However, with this code:
--- CODE ---
https://www.php.net/manual/en/function.register-shutdown-function.php
Regards
--
Manuel Canga
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
En sáb, 15 feb 2020 09:22:41 +0100 Larry Garfield
escribió
> On Fri, Feb 14, 2020, at 1:04 AM, Manuel Canga wrote:
>
> > Maybe, bettern fn: * fn(callable $to_clsoure ): *closure ?
> >
> > I know fn is used in arrow functions. However, for that same re
En sáb, 15 feb 2020 09:22:41 +0100 Larry Garfield
escribió
> On Fri, Feb 14, 2020, at 1:04 AM, Manuel Canga wrote:
>
> > Maybe, bettern fn: * fn(callable $to_clsoure ): *closure ?
> >
> > I know fn is used in arrow functions. However, for that same re
On Fri, 14 Feb 2020 at 01:39, Mike Schinkel wrote:
> > On Feb 13, 2020, at 7:24 PM, Rowan Tommins
> wrote:
> >
> > An idea I had earlier which might solve some of them is if what was
> returned was not a normal Closure instance, but a new class like
> FunctionReference. It could then "remember"
On Thu, 13 Feb 2020 at 08:58, Rowan Tommins wrote:
> On 12 February 2020 23:12:34 GMT+00:00, Manuel Canga <
> manuelca...@gmail.com> wrote:
> >El mié., 12 feb. 2020 23:01, Rowan Tommins
> >escribió:
> >In your example, you has the same options:
> >
> >
El mié., 12 feb. 2020 23:01, Rowan Tommins
escribió:
> On 12/02/2020 21:47, Manuel Canga wrote:
> > You is importing function and you are using different. It is the same
> > case like:
> >
> > namespace MyProject;
> >
> > use Vendor/Controller;
>
El mié., 12 feb. 2020 22:36, Rowan Tommins
escribió:
> On 11/02/2020 15:13, Manuel Canga wrote:
> > One case which string can be useful but a callable would not be
> acceptable is:
> >
> > array_map([I18N::class, translate::function] );
>
>
> I wouldn't e
On Wed, 12 Feb 2020 at 15:08, Dan Ackroyd wrote:
> On Tue, 11 Feb 2020 at 13:19, Nikita Popov wrote:
> >
> > https://wiki.php.net/rfc/consistent_callables.
> >
>
> btw it's probably worth mentioning the other reason I didn't pursue
> https://wiki.php.net/rfc/consistent_callables.
>
> By itself,
On Tue, 11 Feb 2020 at 17:49, Dan Ackroyd wrote:
>
> Nicolas Grekas wrote:
> > I wish this would return a Closure instead, making $foo::function the
> > equivalent of Closure::fromCallable($foo).
>
> I didn't include the following in that RFC, because I thought it would
> be too controversial, but
On Tue, 11 Feb 2020 at 17:49, Dan Ackroyd wrote:
>
> Nicolas Grekas wrote:
> > I wish this would return a Closure instead, making $foo::function the
> > equivalent of Closure::fromCallable($foo).
>
> I didn't include the following in that RFC, because I thought it would
> be too controversial, but
On Tue, 11 Feb 2020 at 16:27, Levi Morrison
wrote:
>
> I have three immediate thoughts:
>
> 1. It should be `fn` or `function`; reserving a new word even if it's
> contextual is pointless here.
> 2. It should support methods.
> 3. It should return a closure, not a string. The reason is for
> consi
On Tue, 11 Feb 2020 at 15:51, Chase Peeler wrote:
>
>
>
> On Tue, Feb 11, 2020 at 8:19 AM Nikita Popov wrote:
>>
>> On Tue, Feb 11, 2020 at 1:43 PM Manuel Canga wrote:
>>
>> > On Tue, 11 Feb 2020 at 13:16, Nicolas Grekas
>> > wrote:
>>
On Tue, 11 Feb 2020 at 14:19, Nikita Popov wrote:
>
> On Tue, Feb 11, 2020 at 1:43 PM Manuel Canga wrote:
>>
>> On Tue, 11 Feb 2020 at 13:16, Nicolas Grekas
>> wrote:
>> >
>> >
>> >
>> > Le mar. 11 févr. 2020 à 12:52, Diogo Galvao
Ups!. What big mistake!
Then ::function should be a better option.
Thanks, Guilliam,
On Tue, 11 Feb 2020 at 13:47, Guilliam Xavier wrote:
>
> Hi,
>
> On Tue, Feb 11, 2020 at 1:09 PM Manuel Canga wrote:
> >
> > I was thinking about 'function' or 'func
On Tue, 11 Feb 2020 at 13:16, Nicolas Grekas
wrote:
>
>
>
> Le mar. 11 févr. 2020 à 12:52, Diogo Galvao a écrit :
>>
>> On Tue, Feb 11, 2020 at 8:14 AM Manuel Canga wrote:
>> >
>> > Hi internals,
>> > I Would like to present a possible
'func' will be more
consistent.
Thanks, Diogo,
On Tue, 11 Feb 2020 at 12:51, Diogo Galvao wrote:
>
> On Tue, Feb 11, 2020 at 8:14 AM Manuel Canga wrote:
> >
> > Hi internals,
> > I Would like to present a possible new "::func resolution" for your
&
ully qualified name and importing it.
> However, an explicit, separate, import of these constants is still
> needed, which is not ideal.
>
> A suffix "::func" would also be useful, but allowing shorter notation
> would improve readability when using the functional programming
I'm sorry. I forgot subject due to nerves. I add it.
On Tue, 11 Feb 2020 at 12:13, Manuel Canga wrote:
>
> Hi internals,
> I Would like to present a possible new "::func resolution" for your
> consideration.
>
> In first place, PHP now support "
Hi internals,
I Would like to present a possible new "::func resolution" for your
consideration.
In first place, PHP now support "::class" in this way:
use My\I18N;
$mapped_array = array_map([I18N::class, 'translate'], $array);
It avoid add Full I18N namespace in callback.
However with functio
57 matches
Mail list logo