---
title: "The turbofish meet the elephpant"
url: https://www.exakat.io/the-turbofish-meet-the-elephpant/
date: 2026-06-04
modified: 2026-06-04
author: "dams"
description: "The turbofish meet the elephpant: 🐟 Somewhere, probably on an infinite step of grass, the turbofish meets the elephpant. You'll need imagination to picture that, for sure, but by November,..."
categories:
  - "Technology"
tags:
  - "generics"
  - "rfc"
image: https://www.exakat.io/wp-content/uploads/2026/06/fish.320.jpg
word_count: 553
---

# The turbofish meet the elephpant

# The turbofish meet the elephpant: 🐟

Somewhere, probably on an infinite step of grass, the turbofish meets the elephpant. You'll need imagination to picture that, for sure, but by November, you'll probably have it in your reality. So, what is this new fish, and what does it have to do with generic types? Let's take a look at the future.

## The Bound-erased Generics RFC

If you have been following php.internals lately, you have probably noticed that the long-awaited generics RFC finally has some serious RFC candidate. And buried inside the proposal is a weird piece of syntax. It is borrowed straight from Rust, and it is coming with its own folklore: the turbofish.

The name alone is worth a moment. It was coined spontaneously in a Reddit thread by Rust developers who looked at the `::` operator and thought it looked like a speeding fish. They were not wrong, but it takes some culture or some effort to find it. Look at that:

// This is a turbofish 🐟
collect::()

Squint a little. The double colon is the body, the angle brackets are the tail fins, and the whole thing seems to be charging forward to the left, at high velocity. The Rust community embraced the funny name, and it has stuck for years. As the elePHPant community, we are in no position to blame them.

Now, the recent PHP generics RFC, also called the Bound-Erased Generic Types RFC, written by Seifeddine Gmati, brings that exact same syntax to PHP. Now that the presentations are done, what does it actually do?

## The Problem Turbofish Solves

Generics let you write code that works over a type rather than a specific type. Think of the classic `Cache:` a cache that holds elements of whatever type is used when it is used (sic). The PHP RFC puts it elegantly:

`Generics are to types what functions are to values. `

A function abstracts over a value; generics abstract over a type.

But here is the catch. Once you have a generic function like this

`function identity(T $value): T { return $value; }`

how do you tell PHP, at a specific call site, which type T should be? Most of the time you don't need to: PHP, and any good static analyser, can infer it from the passed argument. Now, this only happens at execution time, and sometimes it pays to be explicit. That or the engine genuinely cannot figure it out on its own. That's exactly when the turbofish arrives:

Worth noting: the turbofish is completely optional. Adding generics to an existing function or class does not break any call. Old call sites continue to work unchanged. You only write `::` when you specifically want to be explicit. This is the backward-compatibility safety net baked into the design.

## Why the Weird :: Syntax?

This is the question everyone asks, and it has a genuinely interesting answer. Why not just write `identity($x)`, like you would in TypeScript or Java?

The short answer is: because the parser doesn't like it.

Imagine the PHP parser sees `identity`. It has to make an instant decision about what that `