Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: white spaces between the sigil and the variable ( $ x = )

by BrowserUk (Patriarch)
on Oct 27, 2008 at 02:28 UTC ( [id://719694]=note: print w/replies, xml ) Need Help??


in reply to Re^2: white spaces between the sigil and the variable ( $ x = )
in thread white spaces between the sigil and the variable ( $ x = )

$foo{ three } = $doit->( 1 ); $quux{ two } = get_that( 25 );

There. All better now :) (And (probably?) compatible with Perl 6)

My justifictions:

  1. $foo  {three} looks like the scalar $foo juxtaposed against a bare-block containing a bareword.

    Conversely, this $foo{ says, hash; and this $foo{ three } is clearly addressing the element keyed with three in the hash named %foo.

  2. Ditto $quux {two}
  3. $doit -> (1 ); looks like the scalar $foo fired an arrow at a big-bottomed girl's left butt-cheek.

    Conversely, this $doit->(   1 ) obviously dereferences the scalar $doit and attempts to call it as a subroutine passing 1 as the parameter.

  4. get_that (25) reads like an extract from a foriegn correspondant's newspaper article: "The bride, get_that (25), was resplendent in her gown of layered white taffeta..."

    Whereas this get_that( 25 ); is obviously calling a subroutine.

    Though if you're using a small enough font, that silly underscore seems to disappear, and suddenly it turns into Patrick McGoohan giving an order to that bit-part cast member you knew was destined to die this episode, because of his identifier.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: white spaces between the sigil and the variable ( $ x = )
by JavaFan (Canon) on Oct 27, 2008 at 22:57 UTC
    $foo{ three } = $doit->( 1 ); $quux{ two } = get_that( 25 );
    There. All better now :) (And (probably?) compatible with Perl 6)
    I think it fails in at least three ways:
    1. When accessing a hash element, the sigil in Perl6 is %, not $.
    2. The autoquoting shortcut has been replaced with a construct that requires as many keystrokes as using quotes. I'm not quite sure what %foo{three} does in Perl6, but I think it's the same as %foo{three()}. The Perl5 equivalent of $foo{three} is %foo{'three'} or %foo<<three>>. The latter can also be written using some Latin-1/Unicode character, but I can't be bothered to look up its code. It's a character that isn't on a standard US keyboard. But someone out there who held on to his APL keyboard will be very happy with Perl6.
    3. The arrow is gone. Perl bows its head to Java, and uses a dot. So it's $doit.(1). Or maybe &doit.(1), just as one uses % to access a hash element.

      I meant whitespace-wise. That you don't have to give up (subjectively) good formatting, because Perl 6 doesn't allow spaces between the identifier and the open paren/curly/bracket.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^4: white spaces between the sigil and the variable ( $ x = )
by blazar (Canon) on Oct 27, 2008 at 22:39 UTC
    $foo{ three } = $doit->( 1 ); $quux{ two } = get_that( 25 );

    There. All better now :) (And (probably?) compatible with Perl 6)

    I personally believe that it strongly depends on how you're interpreting "compatible:" in fact the new dereferencer is a single dot and not an arrow any more - something that as far as I'm concerned (FWIW) seems reasonable and desirable 95% of the times and will make me regret the arrow the remaining 5% - but then think of the usefulness and clarity of dereferencing the implicit topicalizer (which is $_ as usual) and how ugly that would be if an arrow were to be used instead! Oh, and again I for one cherish the arrow now used for pointy subs, but that's mainly in connection with an RPL thingie that's very personal and possibly uninteresting to annoying for others so that I'm not repeating it here once more...

    --
    If you can't understand the incipit, then please check the IPB Campaign.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://719694]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-19 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found