On Sun, Oct 29, 2023, at 9:52 PM, Jorg Sowa wrote:
> I really like the idea and I would love to see it in PHP. I'm wondering
> however, what would be the scope of the feature and how complex would be
> designed type system. Examples I saw in this thread could be easily
> replaced with union and
I really like the idea and I would love to see it in PHP. I'm wondering
however, what would be the scope of the feature and how complex would be
designed type system. Examples I saw in this thread could be easily
replaced with union and intersection types (i.e. numeric as int|float). In
my
On 26 October 2023 23:35:56 BST, Deleu wrote:
>I would love it if we could bring up a discussion on proposing changes to
>the PHP Namespace system to allow for something more like ESM while
>considering we don't have a build system and a hot-reload system, but I'm
>just not sure if PHP Type
> On Oct 26, 2023, at 3:23 PM, Larry Garfield wrote:
>
> App-wide aliases run into the autoloading problem. If the engine runs across
> the add() function above, and "numeric" isn't defined, what can it do?
> Currently, all it can do is trigger autoloading, which only works for
> class-ish
Why are we reinventing alias syntax? We already have "use" to alias per file:
use My\Namespace\MyFancyType as MyNewFancyType;
use string|int|bool as MyFancyType;
Further, in PHP we specify a type using a colon, not an equal sign,
thus this feels more idiomatic to PHP (and less ambiguous):
type
> Le 26 oct. 2023 à 21:23, Larry Garfield a écrit :
>
> App-wide aliases run into the autoloading problem. If the engine runs across
> the add() function above, and "numeric" isn't defined, what can it do?
> Currently, all it can do is trigger autoloading, which only works for
> class-ish
Since there may be need for reusability, I feel it can have this kind of
structure:
// File: A.php
```
namespace A;
typedef TypeLists {
type Msg = string|null;
type Numeric = int|float;
type MyClass = \Package\Test|\Package\Db;
}
```
// file: B.php
```
I'll use it a lot if they'll be namespaced. It avoids name-collision using
the existing ecosystem and we already use lots of "uses" in our codes.
When Enums came to the party, they came namespaced as traits, classes and
interfaces. The last 2 represent types, concrete and abstract.
User defined
On Thu, Oct 26, 2023 at 4:23 PM Larry Garfield
wrote:
> On Thu, Oct 26, 2023, at 6:37 AM, Oladoyinbo Vincent wrote:
>
> App-wide aliases run into the autoloading problem. If the engine runs
> across the add() function above, and "numeric" isn't defined, what can it
> do? Currently, all it can
On Thu, Oct 26, 2023, at 6:37 AM, Oladoyinbo Vincent wrote:
> Greetings to you all,
>
> I will like to submit an RFC on introducing type alias to php.
>
> Even though Generics won't or never be introduced to PHP, personally i will
> like php to add the type alias feature.
>
> Type aliases provide
Hi,
On 26.10.23 08:37, Oladoyinbo Vincent wrote:
Greetings to you all,
I will like to submit an RFC on introducing type alias to php.
Even though Generics won't or never be introduced to PHP, personally i will
like php to add the type alias feature.
Type aliases provide a mechanism to create
On 26.10.2023 08:37, Oladoyinbo Vincent wrote:
type MyType = string|null;
function greetings(MyType $message): string {
// Implementation
}
greetings(1); // TypeError
When writing RFC you'd have to decide/clarify whether you want this to
be an error in strict_types mode only or not.
I would like to voice my support for this and i'm willing to help with
the implementation. As for differentiating between type aliases and
classnames, only one of them can be instantiated.
Lanre
On 2023-10-26 12:37 a.m., Oladoyinbo Vincent wrote:
Greetings to you all,
I will like to submit
Hi Saki,
I will have to disagree as the convenience doesn't come from the
complexity of union types, rather how many times its used. Its easier to
use ConstantNode in 10 functions vs NodeA|NodeB|NodeC.
On 2023-10-26 6:58 a.m., Saki Takamachi wrote:
Hi,
It seems to me that there is more to
Hi,
It seems to me that there is more to lose than gain. I'm afraid that when we
look at the signature, we'll be confused as to whether it's a class or a type.
Even if these problems were successfully resolved, I feel that it would only
reduce readability. I've never seen a union type complex
On Thu, Oct 26, 2023 at 8:37 AM Oladoyinbo Vincent
wrote:
>
> Greetings to you all,
>
> I will like to submit an RFC on introducing type alias to php.
>
> Even though Generics won't or never be introduced to PHP, personally i will
> like php to add the type alias feature.
>
> Type aliases provide
Greetings to you all,
I will like to submit an RFC on introducing type alias to php.
Even though Generics won't or never be introduced to PHP, personally i will
like php to add the type alias feature.
Type aliases provide a mechanism to create more descriptive and readable
type hints in PHP
17 matches
Mail list logo