in reply to Re: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
in thread RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl

> because it's a workaround for the inability to return multiple value that Perl has naturally.

O rly? ;)

const metadata = { title: 'Scratchpad', translations: [ { locale: 'de', localization_tags: [], last_edit: '2014-04-14T08:43:37', url: '/de/docs/Tools/Scratchpad', title: 'JavaScript-Umgebung' } ], url: '/en-US/docs/Tools/Scratchpad' }; let { title: englishTitle, // rename translations: [ { title: localeTitle, // rename }, ], } = metadata; console.log(englishTitle); // "Scratchpad" console.log(localeTitle); // "JavaScript-Umgebung"

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^2: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
  • Download Code

Replies are listed 'Best First'.
Re^3: RFC: Destructuring Assignment (aka Unpacking aka Type Patterns) in pure Perl
by ikegami (Patriarch) on Jul 03, 2020 at 20:20 UTC
      You do realize that Perl can't do this naturally, right?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        I get it now. I wasn't aware of the recursive nature of the assignment. There's no mention of that in the MDN page. I've used it extensively, but not recursively as you demonstrated. (Upd: Sigh, I'm blind. Brainy not worky.)

        uh? It can. Anyway, my post was confusing two concepts and I'm rewriting it (as a separate post). This will be evident there.