# [phpng] naming

- Thread: https://externals.io/message/74004
- Original archive: https://news-web.php.net/php.internals/74004
- Started by Pierre Joye on 2014-05-07T08:54:56+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #74004 — Pierre Joye — 2014-05-07T08:54:56+00:00

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

hi,

would it be possible to "clean up" the naming while being at it?

I would prefer longer but clearer/less confusing names rather than
trying to reduce the type strokes.

For example:

ZVAL_ARR() > ZVAL_ARRAY
ZVAL_NEW_ARR()  > ZVAL_NEW_ARRAY (btw, ZVAL_NEW_ARRAY is wrongly
documented in the wiki draft, section about arrays)

Other engine's APIs use full names, to go back and forth between these
convention is error prone and not too clean. Thoughts?

Yes, it is a detail, but better to fix this now than latter :)

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #74006 — Dmitry Stogov — 2014-05-07T10:33:21+00:00

URL: https://externals.io/message/74004#74006 · In reply to: #74004

I would be just glad. Having clear uniform naming would be fine.
We should just come to agreement about the actual names and I don't think
it's a big problem.

Thanks. Dmitry.




> hi,
>
> would it be possible to "clean up" the naming while being at it?
>
> I would prefer longer but clearer/less confusing names rather than
> trying to reduce the type strokes.
>
> For example:
>
> ZVAL_ARR() > ZVAL_ARRAY
> ZVAL_NEW_ARR()  > ZVAL_NEW_ARRAY (btw, ZVAL_NEW_ARRAY is wrongly
> documented in the wiki draft, section about arrays)
>
> Other engine's APIs use full names, to go back and forth between these
> convention is error prone and not too clean. Thoughts?
>
> Yes, it is a detail, but better to fix this now than latter :)
>
> Cheers,
> --
> Pierre
>
> @pierrejoye | http://www.libgd.org

---

## #74024 — Marc Bennewitz — 2014-05-07T17:57:10+00:00

URL: https://externals.io/message/74004#74024 · In reply to: #74006

Hi,

I would also prefer to name it was it represents. I mean a ZVAL 
represents a PHP typed value and not a C typed one. So for example 
IS_LONG would be IS_INTEGER and IS_DOUBLE would become IS_FLOAT.

Marc


> I would be just glad. Having clear uniform naming would be fine.
> We should just come to agreement about the actual names and I don't think
> it's a big problem.
>
> Thanks. Dmitry.
>
>
> 
>
> > […]

---

## #74025 — Andrea Faulds — 2014-05-07T17:59:55+00:00

URL: https://externals.io/message/74004#74025 · In reply to: #74024

> I would also prefer to name it was it represents. I mean a ZVAL represents a PHP typed value and not a C typed one. So for example IS_LONG would be IS_INTEGER and IS_DOUBLE would become IS_FLOAT.


However, integers in PHP are usually abbreviated to just “int”s, so I think that one should be IS_INT. :)

--
Andrea Faulds
http://ajf.me/

---

## #74028 — Rowan Collins — 2014-05-07T18:11:46+00:00

URL: https://externals.io/message/74004#74028 · In reply to: #74024

Marc Bennewitz wrote (on 07/05/2014):
> Hi,
>
> I would also prefer to name it was it represents. I mean a ZVAL 
> represents a PHP typed value and not a C typed one. So for example 
> IS_LONG would be IS_INTEGER and IS_DOUBLE would become IS_FLOAT.
>
> Marc 

Ooh, that reminds me of something I've been meaning to file a bug for, 
and maybe even attempt a patch, if I can understand where it comes from: 
the message shown *to the user* when an internal function is passed an 
invalid value uses "double" and "long" instead of "float" and "int".

To somebody not familiar with C or similar languages, the message 
"some_function() expects parameter 1 to be long, string given" is 
somewhat cryptic to say the least, particularly because long is an 
adjective not a noun in standard English, so it could easily be misread 
as something like "parameter 1 is not long enough".

Just a pet peeve...
-- 
Rowan Collins
[IMSoP]

---

## #74029 — Andrea Faulds — 2014-05-07T18:51:54+00:00

URL: https://externals.io/message/74004#74029 · In reply to: #74028

> Marc Bennewitz wrote (on 07/05/2014):
> > […]
> 
> Ooh, that reminds me of something I've been meaning to file a bug for, and maybe even attempt a patch, if I can understand where it comes from: the message shown *to the user* when an internal function is passed an invalid value uses "double" and "long" instead of "float" and "int".
> 
> To somebody not familiar with C or similar languages, the message "some_function() expects parameter 1 to be long, string given" is somewhat cryptic to say the least, particularly because long is an adjective not a noun in standard English, so it could easily be misread as something like "parameter 1 is not long enough".
> 
> Just a pet peeve...


…that’s probably from zend_parse_parameters, no?

--
Andrea Faulds
http://ajf.me/
