Re: [PHP-DEV] SSL stream context 'local_pk' issue?

2020-01-07 Thread Kosit Supanyo
standard API) as TLS web server? Should I give up what I'm doing? Cheers Kosit On Sun, Jan 5, 2020 at 8:42 PM Thomas Hruska wrote: > On 1/5/2020 4:46 AM, Kosit Supanyo wrote: > > Hi Internals > > > > First of all, Happy new year! > > > > I've

[PHP-DEV] SSL stream context 'local_pk' issue?

2020-01-05 Thread Kosit Supanyo
Hi Internals First of all, Happy new year! I've found that everytime `stream_socket_accept()` accepts a SSL/TLS connection, it always read 'local_cert' and 'local_pk' files despite being read and verified before by `stream_socket_server()`. There's no problem with 'local_cert' but 'local_pk' beca

Re: [PHP-DEV] [RFC] anti-coalescing-operator

2019-10-24 Thread Kosit Supanyo
at 4:53 AM Ken Stanley wrote: > > On Thu, Oct 24, 2019 at 5:19 PM Kosit Supanyo > wrote: > >> Hi Ken >> >> I totally agree with Andreas especially: >> >> One purpose of the operator should be that you don't have to repeat >>> the variabl

Re: [PHP-DEV] [RFC] anti-coalescing-operator

2019-10-24 Thread Kosit Supanyo
Hi Bruce If I understand correctly. $_SERVER['fname'] !?? $user->setName($_SERVER['fname']); Will return the result of $user->setName($_SERVER['fname']) if $_SERVER['fname'] is set or null if not set. While: isset($_SERVER['fname']) && $user->setName($_SERVER['fname']); Will return boolean

Re: [PHP-DEV] [RFC] anti-coalescing-operator

2019-10-24 Thread Kosit Supanyo
Hi Ken I totally agree with Andreas especially: One purpose of the operator should be that you don't have to repeat > the variable. Here you do, e.g. $_SERVER['fname'] But if this operator provide some way not to repeat the variable it will make sense. For example: $_SERVER['fname'] !?? $user

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-21 Thread Kosit Supanyo
eel it is more comfortable if they are able to write well structured and and cleaner codes by this way. Regards On Tue, Oct 22, 2019 at 3:42 AM Mike Schinkel wrote: > On Oct 20, 2019, at 11:11 PM, Kosit Supanyo > wrote: > > Ok, so let's look at a scenario. Will we be able to

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-21 Thread Kosit Supanyo
gt; choice in other languages is _, but that's a valid and commonly used > function name): About that, I'm working on a different approach which I would like to show you after I finished the next demo :) Regards On Mon, Oct 21, 2019 at 8:52 PM Rowan Tommins wrote: > Hi Kosit, &

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-21 Thread Kosit Supanyo
Hi Mike > Ok, so let's look at a scenario. Will we be able to do this in the future, > if we decide to allow multiple expressions to result in a final value? > $y = switch ($x) { > case 1 => $arr = get_array(), array_pop($arr), > case -1 => $arr = get_array(), array_unshift($arr), > d

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-21 Thread Kosit Supanyo
essions and its behavior is to break outer loop, don't you think it could be an another inconsistency or confusion? Because I'm 100% sure when people see `break` within `switch` they'll all think it should break `switch` not something else. Regards On Mon, Oct 21, 2019 at 4:12 AM Mike Schi

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-21 Thread Kosit Supanyo
rote: > Hi Kosit, > > There's some really interesting ideas in here, thanks for sharing them. > > > On 19/10/2019 17:40, Kosit Supanyo wrote: > > Like function declaration and function expression in JavaScript, if > > `switch` appears as first token at stat

Re: [PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-20 Thread Kosit Supanyo
ady pushed to VM stack. As I know ongoing function calls can only be aborted by exceptions (and `return` should not be allowed either, I need to fix that) so expressions must give something or throw. Cheers On Sun, Oct 20, 2019 at 6:52 AM Mike Schinkel wrote: > > On Oct 19, 2019, at 12:40 P

[PHP-DEV] 'switch-expression' and the 'type guard' unary operator demo

2019-10-19 Thread Kosit Supanyo
Hi Internals I've just finished an implementation of 'switch-expression' that have been discussed recently. So I would like to present my ideas here. The basic syntax of switch-expression in this implementation is: $result = switch ($expr) { case $cond1 => $result1, case $cond2 => $resul

Re: [PHP-DEV] Inline switch as alternative to nested inline conditional

2019-10-16 Thread Kosit Supanyo
Hi Robert That is impossible to implement because there's no way to tell the parser that `switch` is statement or expression and it conflicts with `=>` in array key expression (that's why PHP chose to have arrow function with `fn` prefixed). And IMO your idea is harder to read than normal assignme

Re: [PHP-DEV] Inline switch as alternative to nested inline conditional

2019-10-16 Thread Kosit Supanyo
ot;; You may think t's fine because Java uses semicolon but IMO Java had made a mistake. (C# is semantically correct) Cheers On Wed, Oct 16, 2019 at 2:54 PM Michał Brzuchalski < michal.brzuchal...@gmail.com> wrote: > Hi Kosit, > > śr., 16 paź 2019 o 09:41 Kosit Supanyo > n

Re: [PHP-DEV] Inline switch as alternative to nested inline conditional

2019-10-16 Thread Kosit Supanyo
Hi Michal I'had the idea similar to your RFC but instead of using `switch` keyword I think introducing `when` keyword is better. (as I know a language that uses this keyword is Kotlin) $result = when ($v) { 'foo' => 1, 'bar' => 2, 'x', 'y', 'z' => 3, default => null, }; Above you

Re: [PHP-DEV] Question about `global` variable declaration

2019-09-21 Thread Kosit Supanyo
ables.scope.php and I'd never seen those forms of `global` in any projects/articles before. Cheers On Sat, Sep 21, 2019 at 9:26 PM Zeev Suraski wrote: > On Sat, Sep 21, 2019 at 3:09 PM Kosit Supanyo > wrote: > >> I understand your point but inconsistency in my sense is syntac

Re: [PHP-DEV] Question about `global` variable declaration

2019-09-21 Thread Kosit Supanyo
why I see it as inconsistency. P.S. I wrote this not because I want to convince you to make any change but just to explain my point. Cheers On Sat, Sep 21, 2019 at 6:24 PM Nikita Popov wrote: > On Sat, Sep 21, 2019 at 12:58 PM Kosit Supanyo > wrote: > >> Hi Dan and Internals

Re: [PHP-DEV] Question about `global` variable declaration

2019-09-21 Thread Kosit Supanyo
n Sat, Sep 21, 2019 at 5:52 PM Nikita Popov wrote: > On Sat, Sep 21, 2019 at 11:56 AM Kosit Supanyo > wrote: > >> Hi Internals >> >> I'm working on my new proposals and I've found weirdness of global >> variable >> declaration in zend_language_parse

[PHP-DEV] Question about `global` variable declaration

2019-09-21 Thread Kosit Supanyo
Hi Internals I'm working on my new proposals and I've found weirdness of global variable declaration in zend_language_parser.y. global_var: simple_variable { $$ = zend_ast_create(ZEND_AST_GLOBAL, zend_ast_create(ZEND_AST_VAR, $1)); } ; Above grammer allows something like this... glo

[PHP-DEV] [Discussion] `ifset()` language construct

2019-09-15 Thread Kosit Supanyo
Hi Internals I don't have permission to create RFCs but I would like to propose/discuss new language construct called `ifset()` which is syntactic sugar to null coalescing operator with rhs value `null`. The goal of this proposal is similar to Andrea Fauld's proposal ( https://wiki.php.net/rfc/una

Re: [PHP-DEV] [RFC] Reclassifying engine warnings

2019-09-13 Thread Kosit Supanyo
Hi internals This maybe a little bit late but I would like to propose alternative to this RFC. What if we add `strict_errors` declare to make every function/method in files that declared `strict_errors` throw ErrorException on Notice/Warning. Example: File: Test.php https://github.com/webdevxp/

Re: [PHP-DEV] Re: [RFC] Arrow functions / short closures

2019-04-09 Thread Kosit Supanyo
Hi internals, This is my first write to this list but I've been followed your discussions quite a while ago. For a brief introduction, my name is Kosit, I'm a programmer from Thailand and I've been using PHP since version 3 (for a short period before moving to PHP4). I'm a fan of `fn` syntax and