On Thu, Aug 11, 2005 at 09:52:18PM -0700, Ashley Winters wrote: : On 8/11/05, Larry Wall <[EMAIL PROTECTED]> wrote: : > So either we have to bifurcate the concept into "temporarily constant" : > and "permanently constant", or we force people to distinguish with ::= : > (or "is constant('foo')"), or we make some representations about the : > requirement for the compiler to optimize the = form to: : > : > my Str $x is constant('foo'); : : Why isn't the late binding version : : my Str $x is ro('foo'); : : In contrast to the 'is rw' trait? When I say 'is constant', can I be : rewarded for all my extra typing with some well-defined compile-time : optimization?
I think "ro" is ugly and impenetrable and too easy to mistake for "rw". But if we're actually going to have a different lifetime on the info, it isn't really a "my", and we should probably have a different declarator: constant Str $x = 'foo'; That would scope the name like "my", but alias a permanent location like "our", except that the permanent location is also immutable. It can have its own '=' desugaring separate from "my", and "my" stays a run-time assignment in the abstract. (It's not entirely clear whether constant should desugar to begin() or init() though...) If we have that, then maybe "is constant" is confusing for the other meaning, and we can change it to "is readonly", which then becomes the default for formal parameters, so you'll almost never see it, and it's okay for it to be huffmanly long, and violate the "perfect language" aspects of rw/ro. On the other hand, it's possible I could be argued into "ro", by the similar argument that you'll almost never see it. Larry