what does p stand for in Read(p []byte) (int, error)

153 views
Skip to first unread message

محمد بومنذر

unread,
Mar 14, 2022, 12:07:38 PM3/14/22
to golang-nuts
Hey, I got curious about the meaning of p, so I decided to ask.

Thanks in advance.

Ian Lance Taylor

unread,
Mar 14, 2022, 3:23:36 PM3/14/22
to محمد بومنذر, golang-nuts
‪On Mon, Mar 14, 2022 at 9:07 AM ‫محمد بومنذر‬‎
<mohamme...@gmail.com> wrote:‬
>
> Hey, I got curious about the meaning of p, so I decided to ask.

It seems to date back to when the Reader interface was first written,
back when Go looked somewhat different than it does today:

https://go.googlesource.com/go/+/7c9e2c2b6c2e0aa3090dbd5183809e1b2f53359b%5E%21/#F1

I don't know for sure but I'm going to guess that "p" is short for
"pointer", since back then the argument was indeed a pointer. And
we've just kept the name "p" ever since.

Ian
Reply all
Reply to author
Forward
0 new messages