# Alias for `int|float`

- Thread: https://externals.io/message/112209
- Original archive: https://news-web.php.net/php.internals/112209
- Started by Eugene Sidelnyk on 2020-11-08T17:09:05+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #112209 — Eugene Sidelnyk — 2020-11-08T17:09:05+00:00

URL: https://externals.io/message/112209#112209

Hello, internals!

What do you think about creating shorthand `number` for `int|float`?

---

## #112210 — Reindl Harald privat — 2020-11-08T17:26:05+00:00

URL: https://externals.io/message/112209#112210 · In reply to: #112209

Am 08.11.20 um 18:09 schrieb Eugene Sidelnyk:
> Hello, internals!
> 
> What do you think about creating shorthand `number` for `int|float`?

nothing because:

a) float accepts int anyways
b) overloading the engine for each and every nuance is not helpful
c) union types are clear and readable

---

## #112211 — Benas IML — 2020-11-08T17:28:08+00:00

URL: https://externals.io/message/112209#112211 · In reply to: #112210

...and introducing 'number' would also be a huge BC break (even in our
codebase there's a class named 'Number').

Best regards,
Benas


On Sun, Nov 8, 2020, 7:26 PM Reindl Harald (privat) <harry@rhsoft.net>
wrote:

>
>
> Am 08.11.20 um 18:09 schrieb Eugene Sidelnyk:
> > […]
>
> nothing because:
>
> a) float accepts int anyways
> b) overloading the engine for each and every nuance is not helpful
> c) union types are clear and readable
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php

---

## #112213 — Christoph M. Becker — 2020-11-08T17:55:39+00:00

URL: https://externals.io/message/112209#112213 · In reply to: #112210

> Am 08.11.20 um 18:09 schrieb Eugene Sidelnyk:
> > […]

If at all, it should be called `numeric`, because that is a reserved
word as of PHP 7.0.0:
<https://www.php.net/manual/en/reserved.other-reserved-words.php>.

> nothing because:
>
> a) float accepts int anyways
> b) overloading the engine for each and every nuance is not helpful
> c) union types are clear and readable

ACK.  See <http://svn.php.net/viewvc?view=revision&revision=351123>.

--
Christoph M. Becker

---

## #112214 — Sara Golemon — 2020-11-09T15:24:46+00:00

URL: https://externals.io/message/112209#112214 · In reply to: #112209

> What do you think about creating shorthand `number` for `int|float`?
>

Others have pointed at a few reasons why not, but I'd like to add that if
we allow type aliasing, then projects can choose to define this or not.
I'd rather see the power (and tradeoffs) placed in the hands of script
developers.

-Sara

---

## #112215 — Nuno Maduro — 2020-11-09T15:33:03+00:00

URL: https://externals.io/message/112209#112215 · In reply to: #112214

Agree with what has been said.

We probably should leave this "alias" discussion to a near future where
people would be able to create their own types like so:

```php
type Number = Foo|Bar;
```

- Nuno



> On Sun, Nov 8, 2020 at 11:09 AM Eugene Sidelnyk <zsidelnik@gmail.com>
> wrote:
>
> > […]
>
> Others have pointed at a few reasons why not, but I'd like to add that if
> we allow type aliasing, then projects can choose to define this or not.
> I'd rather see the power (and tradeoffs) placed in the hands of script
> developers.
>
> -Sara
