in reply to equivalent to Hash::Util for lists / arrays

There is of course no equivalent of the locking / unlocking of hash keys for an array.

Locking the values can be achieved by the Readonly module, but I have yet to see a convincing use case for the locking of a whole array.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re: equivalent to Hash::Util for lists / arrays

Replies are listed 'Best First'.
Re^2: equivalent to Hash::Util for lists / arrays
by JavaFan (Canon) on Dec 21, 2010 at 17:24 UTC
    I have yet to see a convincing use case for the locking of a whole array.
    And have you seen it for hashes? I've a hard time imagining someone who can see a convincing case for the one, but not for the other.

    But regardless, whether or not some monks see convincing uses for it or not is irrelevant to the question on whether it exists or not.

      > I've a hard time imagining someone who can see a convincing case for the one, but not for the other.

      In theory yes, IMHO practically many of those cases wouldn't be implemented with arrays right away.

      For instance avoiding typos in keys - in cases where indices have to be reproduced correctly it's anyway better to use a hash.

      And if performance prohibits using hashes, there is nothing faster than using constant lists because of constant folding at compilation ...

      Cheers Rolf