I'm asking people who are familiar with the ideas in extant Perl, how it works, what you can do with it, what its limitations are; in addition to speculating about how it should be in Perl 6. The synopses assumes "same as now" except where it gives hints and contradictions.

Consider:

my Int $x = 17; my Int $y is readonly := $x;
This indicates that readonly is an attribute of the symbol, not the container. The two symbols, $x and $y, have different attributes, rw and readonly respectively.

This situation must be allowed, because it is exactly the same as

sub foo (Int $y) { ... } my Int $x = 17; foo($x);
which is also the same as
my Int $x = 17; $x -> $y { ... }
and likewise when $x is really one object in a multi-item container such as a list, when doing a for loop.

So, what happens in the reverse situation?
my Int $x is readonly = 17; my Int $y := $x;
I think this should be a compile-time error. You can't relax the constraint when creating the alias.

In this case, it is behaving like a type but not like a class, exactly like subset (and where clauses) do. Regardless of whether constraints are part of the symbol, container, or value type, they are checked when that symbol is assigned to, and likewise checked when the symbol is bound. You have the same issue with subsets, to ensure that all aliases agree with the existing constraints. Or rather, you can add to them but not take away.

Meanwhile, some people want to write functions that might take a writable lvalue, or might not. As I see it, this is an error:

sub foo (Int $y is rw) { ... } foo(17); my Int $x is readonly = 17; foo($x);
Is the first call passing a true constant, as opposed to a handle without write access permission? That is, is there a deeper meaning of constant available as well that lets you do constant folding, shared thread data, caching, etc.?

Anyway, if the calls fail at compile time, it is because the readonly is being treated as part of the type, just like subsets as I mentioned earlier. So if someone really wanted to have optional write-back ability, he could write:

sub foo (Int|constInt $y) { ... }
where you had some way of defining the named type constInt (not a class, but type-like in the same manner as subset). More sanely perhaps you could use that in a multi to distinguish a readonly and rw form of the function.

Can you declare constInt in Perl 6 as it is defined thus far, using where or other language features?

I'll stop now and listen to opposing views and inspiration.

—John