Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-17 Thread Me Here
"Carl Mäsak" wrote: > ] Oh, but it gets even better: it turns out they didn't really have to > ] sneak in through native code anyway, at least as far as the JVM is > ] concerned, since the JVM treats final variables as always writable > to ] the class they're defined in! There's no special case fo

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-17 Thread Brandon S. Allbery KF8NH
On 2008 May 17, at 4:10, Carl Mäsak wrote: Whether we're risking the loss of important compiler optimizations by allowing overriding of variable RO-ness is not for me to say, that's up to the compiler writers around here. It seems to me you make it sound worse than it really is, that optimizati

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-17 Thread Carl Mäsak
Me Here (>), Carl (>>), Me Here (>>>): >> > What is the point of marking things readonly if you can turn it off? >> >> There are many possible reasons, I think. >> >> * The code that declares the variable readonly might not be available >> to you (compiled to bytecode, fetched by RCP etc), >> * or

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-15 Thread Me Here
"Carl Mäsak" wrote: > > What is the point of marking things readonly if you can turn it off? > > There are many possible reasons, I think. > > * The code that declares the variable readonly might not be available > to you (compiled to bytecode, fetched by RCP etc), > * or it might be available b

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-15 Thread Brandon S. Allbery KF8NH
On 2008 May 15, at 1:30, Me Here wrote: "John M. Dlugosz" wrote: no strong_type_check :rw in scope can turn that off, in case you want to play dirty tricks. What is the point of be able to mark things readonly if the compiler does reject assignment attempts? (assuming you meant "doesn't")

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-15 Thread Carl Mäsak
"Me Here" (>), John (>>), 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? >> >> I think that is the point of declared types. But, something like >> >> no s

Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)

2008-05-15 Thread Me Here
"John M. Dlugosz" wrote: > Carl Mäsak cmasak-at-gmail.com |Perl 6| wrote: > > Pm (>): > > > > > In Rakudo's case, we just haven't implemented read-only traits > > > on variables yet. > >> > > > > Goodie. I guessed as much. > > > > > >> But yes, I expect that it will be caught as > > > a

Re: Compile-time checking of assignment to read-only variables

2008-05-10 Thread John M. Dlugosz
Patrick R. Michaud pmichaud-at-pobox.com |Perl 6| wrote: 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 bet

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-10 Thread Carl Mäsak
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 th

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-09 Thread John M. Dlugosz
Carl Mäsak cmasak-at-gmail.com |Perl 6| wrote: Pm (>): In Rakudo's case, we just haven't implemented read-only traits on variables yet. Goodie. I guessed as much. But yes, I expect that it will be caught as a compile-time error. And do you agree it's reasonable to expect t

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-09 Thread Patrick R. Michaud
On Fri, May 09, 2008 at 05:09:31PM +0200, Carl Mäsak wrote: > Pm (>): > > In Rakudo's case, we just haven't implemented read-only traits > > on variables yet. > > Goodie. I guessed as much. > > > But yes, I expect that it will be caught as > > a compile-time error. > > And do you agree it's rea

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-09 Thread Carl Mäsak
Pm (>): > In Rakudo's case, we just haven't implemented read-only traits > on variables yet. Goodie. I guessed as much. > 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? // Carl

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-09 Thread Patrick R. Michaud
On Fri, May 09, 2008 at 03:02:28PM +0200, Carl Mäsak wrote: > TSa (>): > > sub bar ($x) > > { > >$x = 3; # error, $x is readonly > >foo($x); # error, could hit rw Str > > } > > By the way, I hope it's possible to make the assignment `$x = 3` to > the read-only variable $x a compile-time

Re: Compile-time checking of assignment to read-only variables (Re: MMD distances)

2008-05-09 Thread TSa
HaloO, Carl Mäsak wrote: By the way, I hope it's possible to make the assignment `$x = 3` to the read-only variable $x a compile-time error. I hope so, too. The variable and its read-only constraint is known at compile time and *not* dependend on the value inside. How it came in there in the f