in reply to Re^9: shift on empty array in list context broken (show context)
in thread shift on empty array in list context broken

hello LanX

Apparantley I am trying to show how little I understand contexts, module building and the debugger. :laugh

I think what I am trying to get at is in principle what the OP is about. A reason for equivalent built-ins providing alternate implementations.

Framing the issue of assignment in differing contexts by different built-ins within a wider context, so to speak.

Amalgamating my existing Perl knowledge along with recently learnt knowledge, to do so. With varying results in the offspring.

As an example, if this is an issue with shift, does pop return a different result?

Also I am looking at how the comma operator is affecting the return list. I am not clear on which built-in is returning undef or empty in list context

  • Comment on Re^10: shift on empty array in list context broken (show context)

Replies are listed 'Best First'.
Re^11: shift on empty array in list context broken (show context)
by LanX (Saint) on Jul 21, 2019 at 17:56 UTC
    > Apparantley I am trying to show how little I understand contexts,

    In that case you might be interested in playing with B::Deparse .

    The -p option will highlight precedence, which is crucial for context

    $ perl -MO=Deparse,-p $a, $b = 666 ($a, ($b = 666)); - syntax OK $

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Yours is a good suggestion. A jaunt into the B Modules would likely be nearly as clear as a Cloven's' Christmas Do.

      As for my proposal of equality between shift and splice, where the true equivalence is almost, but not quite entirely, unresolved; perhaps a subscript into the slice would be in order.