develooper Front page | perl.perl6.language | Postings from May 2008

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

Thread Previous | Thread Next
From:
Brandon S. Allbery KF8NH
Date:
May 17, 2008 07:04
Subject:
Re: Compile-time checking of assignment to read-only variables (Re:MMD distances)
Message ID:
5051CC74-E7E5-44B5-90A9-710F2160DD18@ece.cmu.edu

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 optimizations can still be made in
> many cases, and that a programmer who turns off RO stricture simply
> takes a calculated risk.

The compiler should in fact assume that "is ro" is a hard fact; if the  
programmer chooses to override, on her own head be it.  Examples using  
other existing languages:  GHC doesn't compromise its optimization  
rules just because someone might be using unsafePerformIO (this is in  
fact quite similar as unsafePerformIO means a presumed read-only  
expression can vary at runtime) or unsafeCoerce#.  gcc doesn't  
compromise its just because someone might use an asm() to do something  
naughty where the C / C++ layer can't see it.  Etc.

> I also came to think about this relevant quote from Jamie Zawinski:


Java is a remarkable example of how to do it wrong, for many values of  
"it".

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About