in reply to Optional quotes: to use or not to

Note that bare words aren't allowed inside hash curlies in Perl 6 so using quotes would be sort of future proofing that part of your code.

Replies are listed 'Best First'.
Re^2: Optional quotes: to use or not to
by Tux (Canon) on Jul 10, 2015 at 11:46 UTC

    Then don't use curlies!

    $ perl6 -e'my %h = foo => 1; %h.perl.say' {:foo(1)}<> $ perl6 -e'my %h; %h<foo> = 1; %h.perl.say' {:foo(1)}<>

    FWIW I do not use quotes whenever possible.

    When I use quotes, I use double quotes. always.

    I put all keys of a hash inside quotes in an initialization when any of the keys need quotation, for consistency and visual appealing.


    Enjoy, Have FUN! H.Merijn
      IIRC, curlies are necessary for anonymous hash constructions.

      Single quotes are quite useful, reducing backwhacks, such as:

      print 'The value of $scalar is ', $scalar, ', and this line ends with +\n', "\n";

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        I still much prefer:

        print "The value of \$scalar is $scalar, and this line ends with \\n\n +"; say "The value of \$scalar is $scalar, and this line ends with \\n";

        Enjoy, Have FUN! H.Merijn
Re^2: Optional quotes: to use or not to
by hurricup (Pilgrim) on Jul 10, 2015 at 11:38 UTC

    Well, nice argument, but, Perl6 is a pretty different language at first, and in few years I doubt someone will willingly migrate any serious project from Perl5 to Perl6 because of long born, performance issues and unclear future.

    The point is that other languages does not allow this, I know.