[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [proposal] a new keyword : final
- From: David Given <dg@...>
- Date: Tue, 23 Mar 2010 18:27:55 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 23/03/10 16:56, "J.Jørgen von Bargen" wrote:
[...]
> A smart compiler could eliminate the debug code, when DEBUG is set to false
Of course, a smart compiler should be able to tell that the local is
never being assigned to in the chunk, and is therefore read-only, and do
the optimisation anyway, without needing the new keyword!
I do like the idea of having a certain degree of compile-time const
correctness, but you end up running into semantic issues such as:
final a = {}
a[1] = "foo" -- is this legal?
Unless it becomes utterly trivial --- that is, the const-ness applies to
the variable only, and not the contents --- you very quickly start
straying down the path towards a full type system...
- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }
│ --- Conway's Game Of Life, in one line of APL
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkupCCgACgkQf9E0noFvlzhumgCgwNPPb6cOEI+USNoP7zjdi8Uq
+9gAmwZWyVAnZNMl3rULsVtL1J0p4jjx
=ZcxS
-----END PGP SIGNATURE-----