Merge: add the annotation `readonly` on attributes
authorJean Privat <jean@pryen.org>
Tue, 22 Jul 2014 03:17:07 +0000 (23:17 -0400)
committerJean Privat <jean@pryen.org>
Tue, 22 Jul 2014 03:17:07 +0000 (23:17 -0400)
commitcf5552e2b7b0ffa0b6f5859968ff64c2dd88ff7f
tree7550278a47a0248879a4701cbe66d0da2ebb73a4
parent6f907facf0708d90a8f589370dc44cd5d7ce89a3
parent2bbca75e6961853d4be4c470d33921bfc9ded351
Merge: add the annotation `readonly` on attributes

`readonly` just generate no setter. So the value must be set trough the initial value.

Basically it is like the Scala `val` keyword.
Note that unlike the Java `final` modifier, the value cannot be set in a constructor (use a private setter instead if you need a restriction on the setter visibility)

~~~.rb
class Toto
   var a = new Array[Int] is readonly
end
var t = new Toto
t.a.add 5 # OK
t.a = new Array[Int] # Error: no `a=` in Toto
~~~

Pull-Request: #604
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
src/modelize_property.nit