in reply to Reference in Perl 6

The statement that there are no references in Perl 6 is misleading at best.

In fact, nearly everything is a referece.

# $x is a reference my $x = SomeClass.new(); # this also doesn't need an explicit reference my @a = 1, 2, 3; my $arr = @a; # now you can use $arr instead of @a, though $arr won't flatten into l +ists by default $arr.push('foo') say ~$arr; # 1 2 3 foo

So references aren't gone; just their visibility has decreased drastically, as well as the need for explicit derferencing.

Also function arguments are passed by read-only reference by default.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: Reference in Perl 6
by Anonymous Monk on Aug 19, 2010 at 20:41 UTC
    So references aren't gone; just their visibility has decreased drastically, as well as the need for explicit derferencing.

    This comment fills me with dread. I understand Perl 5, where a reference is a reference, and if I want the thing it refers to, I manually de-reference. Simple enough. I've got that. (I also understand Python's way of doing things: every variable is always a reference, and the system de-references as necessary and everything just works.) But I don't like the sound of (Perl 6's) "their visibility has been decreased drastically". Are there many special cases where sometimes there's auto de-reffing and sometimes there isn't? What is the uniformity of the design that I don't yet see?

      Why do people always assume the worst, and place no confidence whatsoever in the language design team?

      Of course we've worked hard to make the design as non-uniform and counter intuitive as possible</sarcasm>

      Perl 6 - links to (nearly) everything that is Perl 6.

        Sorry, I didn't mean to assume the worst. Refs seem like they might be subtly different in Perl 6, but there's no perldoc perl6reftut to fill in the details. Also, note that I did write: "What is the uniformity of the design that I don't yet see?"

        I think there will be a lot less uncertainty bouncing around once the perldocs are in place. Then when someone says, "Um, I dunno, this particular feature/aspect looks weird -- I don't understand it and it makes me nervous", instead of directing them to the rather dense Synopses or telling them not to worry the design team has done a good job, you can just point them to the relevant self-contained friendly perldoc. :)

        (BTW, although there seems to be a lot of anon monks here, this is only my 2nd post in this thread.)

        Why do people always assume the worst, and place no confidence whatsoever in the language design team?

        The reasons are the history of the project and its implementations. They don't leave much confidence.