Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions source/_posts/2025-08-05-compile-generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ As noted above, though, typing against a generic that is part of a union, like `
Type inference is a feature of many heavily typed languages where the compiler or engine can "figure out" what the type of something is supposed to be based on context. As a trivial example:

```php
function add(int $x, int $y)
function concat(string $x, string $y)
{
return $x + $y;
return $x . $y;
}
```

It's readily obvious that the return type of that function is `int`, so a type inference engine will fill that in for you automatically.
It's readily obvious that the return type of that function is `string`, so a type inference engine will fill that in for you automatically.

That would be very helpful for Generics, especially if runtime Generics ever became possible.

Expand Down