Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
If you reverse their order, it's simply a closure:

$dereferencer = { $^moose.<foo>[1]<bar><baz>[3] }; $dereferencer($datastructure);

Otherwise, you're looking for something like adding $datastructure to a prototype class with $dereferencer as a method, kinda quirky.

Update: two syntactical clarifications. {foo} is wrong because Perl 6 has no barewords; use either {'foo'} or the shorthand above that exploits the list quote operator. $^moose is just a placeholder variable, a scalable extension of the hardcoded $a and $b of sort comparators. There are other ways to express this idea.

Update II (more to the point): I said quirky, but of course I didn't mean impossible. If you're dead set on .<foo>[1]<bar><baz>[3] as a method you can sure compose $datastructure to a role that implements it. Unless I'm messing up the syntax (in which case I hope to be corrected):

role Profound { method dereferencer ($x) { $x.<foo>[1]<bar><baz>[3] } +} ($datastructure but Profound).dereferencer;

In reply to Re: [Perl 6] Any provision for a "dereferencing object"? by gaal
in thread [Perl 6] Any provision for a "dereferencing object"? by blazar

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2021-05-18 18:25 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (183 votes). Check out past polls.