in reply to •Re: On Declaration
in thread On Declaration

Indeed I would get that pedantic. :-) Although I would say that IMO the fudge involved in Array of Hashes or even the even worse List Of Lists or List of Hashes is far more palatteable than the fudge involved in calling our a declaration. The problem to me is that the "standard" english usage is quite different from the usage in computing. In english we consider a declaration to be a statement of fact or a statement of an assertion, or an intention. In computing we usually mean the declaration of the existance of a particular object, and the name to which we shall call it. This is a pretty serious additional meaning, and I've seen a lot of newbies stumble over the distinction.

I realize you have a lot more experience than I do teaching perl, but I wonder if you think about it how often you've had students say "Ok so 'my' creates a lexical variable and 'our' creates a global variable?" Umm no. "So strict catches usage of nonexistant variables?" Umm no. You see what i mean?

Wheras the AoH LoL etc, is a much simpler and easy to explain distinction. Especially when you have Data::Dumper to easily show them the difference/sameness in a visual way. Although I do feel that it is far too easy to blur the concept of the container and the contents of the container in perl. But again I dont think these conceptual problem are much of anything unless you start hacking internals or doing funky mojo.


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Replies are listed 'Best First'.
•Re: Re: •Re: On Declaration
by merlyn (Sage) on Jun 15, 2003 at 13:41 UTC
    But again I dont think these conceptual problem are much of anything unless you start hacking internals or doing funky mojo.
    Well, one very practical outcome of keeping terminology correct about "Array of Hashes" vs "Arrayref of Hashrefs" is that the word "ref" there implies a dereferencing must happen, and that indeed is visible, and important.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      True enough. I more meant the mental tangle that you can get in if you think of a reference to an array as being the same as the scalar that holds the reference. On face value its an obvious distinction, but I think people often get confused when scalars and scalar references get involved. For instance (and I know you know this one) how many variables are there in the following code

      my ($x,$y); $x=\$y; $y=\$x; my $aref=[$x,$y];

      Anyway. :-)


      ---
      demerphq

      <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...