기존 자료구조인 SPL 구현 잘못되서 ArrayObject , SplFixedArray < - 끔찍
새로 만들어서 8.1에 넣으려니까 익스텐션들 전역설정가능해서 네임스페이스 없어서 이름충돌함
8.2에서 그거 해결하고 9.0에 넣으려고 그럼
array_filter($배열, 함수) 함수따로 안쓰고
$map->filter(fn($x) => []); 이런식으로 다른언어들처럼 함수형으로하려고함
// 아래는 RFC로 제안하는 대략적인 인터페이스
https://wiki.php.net/rfc/vector
final class Vector implements IteratorAggregate, Countable, JsonSerializable, ArrayAccess
{
/**
* Construct a Vector from an iterable.
*
* When $preserveKeys is false, the values will be reindexed without gaps starting from 0
* When $preserveKeys is true, any gaps in the keys of the iterable will be filled in with null,
* and negative indices or non-integer indices will be rejected and cause an Exception.
*/
public function __construct(iterable $iterator = [], bool $preserveKeys = true) {}
public function getIterator(): InternalIterator {}
public function count(): int {}
public function capacity(): int {}
public function shrinkToFit(): void {}
public function clear(): void {}
public function setSize(int $size): void {}
public function __serialize(): array {}
public function __unserialize(array $data): void {}
public static function __set_state(array $array): Vector {}
public function push(mixed $value): void {}
public function pop(): mixed {}
public function toArray(): array {}
// Strictly typed, unlike offsetGet/offsetSet
public function valueAt(int $offset): mixed {}
public function setValueAt(int $offset, mixed $value): void {}
public function offsetGet(mixed $offset): mixed {}
public function offsetExists(mixed $offset): bool {}
public function offsetSet(mixed $offset, mixed $value): void {}
// Throws because unset and null are different things, unlike SplFixedArray
public function offsetUnset(mixed $offset): void {}
public function indexOf(mixed $value): int|false {}
public function contains(mixed $value): bool {}
public function map(callable $callback): Vector {}
댓글 0