Re: [RFC] Pattern Matching

From: Date: Wed, 10 Dec 2025 18:20:12 +0000
Subject: Re: [RFC] Pattern Matching
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-129584@lists.php.net to get a copy of this message
Hi Am 2025-12-10 14:37, schrieb Vinicius Dias:
This particular syntax was chosen as it is the same as in Ruby, the only other language we know of that has this functionality.
I don't know how helpful this info is, but I'll provide it anyway. Elixir and Erlang also have the functionality and its syntax is the same, using the ^ character. https://hexdocs.pm/elixir/pattern-matching.html#the-pin-operator
AFAICT this is not quite right. It is supported in Elixir, but not in Erlang. There is a proposal to add it to Erlang, but the corresponding PR is still open, which indicates that it is not accepted yet: https://www.erlang.org/eeps/eep-0055 It's not surprising to me that Elixir supports it, since Elixir is heavily inspired / influenced by Ruby. Best regards Tim Düsterhus

« previous php.internals (#129584) next »