Re: Found Good docs - Revisiting Pike

Duke Normandin <[email protected]> Thu, 8 Jan 2026 16:03:00 -0700
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
On Thu, 8 Jan 2026 15:44:52 -0700
Duke Normandin <[email protected]> wrote:

> I'm currently studying the pike manual/chapter_5.html#5.5 Indexing
>=20
> A sample quote:
>=20
> Function     Syntax    Ident	 Returns
>=20
> Index       a [ b ]    `[]       Returns the index b from a.=20
>=20
> Safe Index  a [? b ]   none      Returns the index b from a, returning 0
> instead of an error of a is 0
>=20
> Lookup	    a ->ident  `->	Looks up the identifier. Same as
>                                 a["ident"].
>=20
> I don't understand the `[] and `-> syntax. I need some simple examples o=
f
> usage. Also a ->ident aka a["ident"] escapes me. What is meant by "Ident=
" i.e.
> "Identifier"?

Found a clue!!

string str;
str =3D "pike";
str[2];     =3D> 107
`[](str,2)  =3D> 107

Which of these two constructs is preferable?
Is there a reason for having two ways of indexing?
=2D-=20
Duke