class A # Option 1: this permits various options for a specific attribute attributes immutable: true, concurrent: true # Option 2: this presumes all attributes are boolean attributes :immutable, :concurrent # Option 3: mix 1 & 2 attributes :immutable, concurrent: [:read, :write] end
# the 'method' scoping A would be a compiler pragma class attributes(:immutable, :concurrent)::A end # this works with arbitrary class paths by inserting before the class or module being created class A::B::attributes(:immutable)::C end
attributeidentifier wouldn't be in any identifier scope (eg variable, method)
class type()::V x: int y: int fun norm() sqrt(x**2 + y**2) end end
attributeswhich btw is ablso amenable to other evolution like static type declaration without having to change the syntax of Ruby. Like in
attr_type my_attr: :String, my_other_attr: :Circle. This is what I opted for in Rlang.