Hi all,

It sounds like scalar objects by Nikita:
https://github.com/<https://github.com/nikic/scalar_objects>nikic<https://github.com/nikic/scalar_objects>/scalar_objects<https://github.com/nikic/scalar_objects>

Regards,
Iván Arias.

Get Outlook for Android<https://aka.ms/AAb9ysg>

________________________________
From: Hendra Gunawan <the.liquid.me...@gmail.com>
Sent: Tuesday, May 25, 2021 10:58:46 PM
To: someniatko <somenia...@gmail.com>
Cc: Karoly Negyesi <kar...@negyesi.net>; Marco Pivetta <ocram...@gmail.com>; 
Lynn <kja...@gmail.com>; internals@lists.php.net <internals@lists.php.net>
Subject: Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

Hello.

>
> ```php
> $array|>map($fn1, ?)|>filter(?, $fn2);
> $array->map($fn1)->filter($fn2);
> ```
>

Whitespace removal is not a solution for code length problems.
You might have a new problem if you do it. "|" is very similar
to the lowercase "L" and uppercase "i".

It's just an extra 3 characters (", ?" or "?, "). For most people,
this is not a problem at all. people tend to write "one statement per line"
rather than "multi statement line". I myself usually write no more than
3 statements per line if they are less than 120 characters.

The real problem is there is no consistency for "haystack vs needle"
position. There are RFCs to fix this (along with the naming convention
problem), but none of them are successful.

> The pipe operator feels like a poor solution while "->" would do
> exactly what people want.

Not so poor if we
* use "~>" as pipe operator rather than "|>"
* redesign the api under their proper namespace and strictly place
  the "haystack" as the first function argument.

Regards,
Hendra Gunawan.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to