http://qs1969.pair.com?node_id=11139943


in reply to Re: Modules to reduce syntax?
in thread Modules to reduce syntax?

> it can remove a significant amount of typing

That's a Pyrrhic victory from level two onwards.

Curlies {} are "spared" for mandatory arrows -> for the price of init and OO overhead.

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

Replies are listed 'Best First'.
Re^3: Modules to reduce syntax?
by perlfan (Vicar) on Dec 27, 2021 at 18:03 UTC
    >Pyrrhic victory

    perhaps a tad hyperbolic? OP asked for reduction in syntax (I read it as more readable) - not even "less typing"; but the only thing I can assuredly tell you is that I tend to use this module a lot nowadays. And it is true that eliminating a paired set of curlies in exchange for some dereference syntax is worth it to me; and "overhead" (whatever that means to the reader) is generally never something I even look at. My optimizations happen on the algorithmic or complexity level; IOW I avoid nesting loops in favor of ... hashes (and references to such) :-) In any case, I should have added a YMMV.
      > perhaps a tad hyperbolic?

      well you said

      > > > The reduction in typing and file size from these 2 characters quickly adds up.

      and that's not the case from the second level on.

      This can be easily overlooked, hence my remark.

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

        The -recurse option to h2o creates accessors for all levels of hash; though I have not tried to see if it works for something like,
        my $ref = { foo => { bar => [ baz => 1, herp => 2, derp => 3 ], }, };
        Or maybe I don't know what you mean by, from the second level on.