Patrick (>), Carl (>>), Patrick (>>>): >> > But yes, I expect that it will be caught as >> > a compile-time error. >> >> And do you agree it's reasonable to expect this of every compiler? > > Reasonable to expect it, yes -- but whether or not this rises to the > level of being a "requirement in the spec" may be a different matter. > > I could envision the possibility that some otherwise-very-capable > Perl 6 implementation might be better served by having such checks > performed at runtime (they have to be done there also) and leaving > compile-time checking as an optimization. I suspect this is what > Pugs did. Or an implementation might not have a clear-cut notion > of "compile time". > > So, as long as the assignment is properly prevented, I think that > may be sufficient. (If the language designers decide otherwise, > that's okay with me too. :-)
I agree, to the extent that I understand your caveat. What we seem to agree on is that a compiler should disallow (obvious) assignments to read-only variables, provided that it is not compiler-architecturally unreasonable for it to do so. The reason I think this is important is that I consider this feature low-hanging fruit. It should be the job of the compiler-writer to please the end-programmer as much as possible (in this case by not letting code through that will die at runtime). Similarly, it should (IMHO) be the job of the language designer to spec the ways in which a compiler can be expected to please the programmer. // Carl