Re: What do we need strict scalar type hints for?
| From: | Levi Morrison | Date: | Mon, 02 Feb 2015 16:53:23 +0000 |
| Subject: | Re: What do we need strict scalar type hints for? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81611@lists.php.net to get a copy of this message | ||
> A use case would be where scalar type hints are detrimental are:
>
> I implement an API that returns integers for entity ids, like 2,3,4,5,6.
> and my web-frontend handles this fine because it's a scalar. Then, you want
> to convert entity ids to UUID. This would break your entire web frontend
> application since it's no longer "integer" whereas the concept of $id is
> good enough.
Others are of the opinion that the type of the value is an important
detail that *should* be managed by something other than automatic
conversion.
I'm going to be fairly busy with work for the next few days but I'll
try to remember to come back and give a few good examples I have for
strict values.