This code defines a structure in C with two elements, and also defines types for an instance of the structure (PLAYER) and a pointer to a structure (PTR_PLAYER).typedef struct foo { int iNumberOfHands; char *pszPlayerName; } PLAYER, *PTR_PLAYER; PLAYER astrScoundrels[]; PTR_PLAYER pstrThisPlayer;
The type definitions are used to created an array of players and a pointer to a player. After all that, you use pstrThisPlayer->iNumberOfHands to get to a structure element using a pointer, and astrPlayer[2].iNumberOfHands to get to the same structure element using the structure itself.
Currently in Perl (there, you knew it was coming eventually), we use the arrow to refer to an object's attributes or members like
In reality, $Query is an object and not a pointer to an object, so we should be using the dot syntax. Therefore, in Perl 6, we will be writing$Query = new CGI; $Value = $Query->param('foo'); # method call
This is what C used all along, so going to the dot syntax is more othogonal. Or better. :)$Query = new CGI; $Value = $Query.param('foo'); # method call
--t. alex
"Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny
ps Good question.
In reply to Re: Noble DOT vs the Allmighty ARROW
by talexb
in thread Noble DOT vs the Allmighty ARROW
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |