yoshi129's avatar

Michał

yoshi129

Member since

270

Total Reputation

5

Total Arguments

6

Total Votes for Arguments

Arguments and votes

2

Don't like the syntax

Share:
Read the RFC: Asymmetric Visibility v2 yoshi129 avatar
yoshi129
voted no
19

Nice addition, but I would change syntax:

class User 
{
    public string $name {
        set($value) {
            if (strlen($value) === 0) {
                throw new ValueError("Name must be non-empty");
            }
            return $value;
        }
    }
 
    public function __construct(string $name) {
        $this->name = $name;
    }
}
Share:
Read the RFC: Property Hooks yoshi129 avatar
yoshi129
voted yes
1

I think the proposition is not "must have" option but it's ok

Share:
Read the RFC: Short Closures 2.0 yoshi129 avatar
yoshi129
voted yes
1

Interface should be contract which a class must fulfill. They should not include any implementation. If you want share implementation you can use traits.

Share:
Read the RFC: Interface Default Methods yoshi129 avatar
yoshi129
voted no
1

I like the proposition, but I would use some special "variable" ($$) for piped value (see v1 proposition: https://wiki.php.net/rfc/pipe-operator) so you don't have to use closures inside pipe to place value

$name = 'my_user_name'
	|> str_replace('_', ' ', $$)
	|> strtolower($$)
	|> ucwords($$)
	|> trim($$);

I don't like mapping function names as strings too

Share:
Read the RFC: The Pipe Operator yoshi129 avatar
yoshi129
voted yes
65

For me, the most important argument is that the pipeline pattern is a tried and tested pattern, that this RFC builds upon. A couple of examples:

This RFC adds syntax to make using these kinds of pattern much more convenient.

On top of that, there's the argument that multiple modern languages support a pipe operator:

Finally, I've had numerous occasions where a pipe operator would simplify my own code — I have more than a handful real life cases where this would be useful.

Share:
Read the RFC: The Pipe Operator Contributor brent avatar
brent
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!