Victor Luchangco | 27 Apr 04:13
Favicon

Re: Getters for constructor parameters


On Apr 26, 2008, at 4:42 PM, Sorin Miklós Zsejki wrote:

> Right now for this:
>
> trait T
>     getter m(): String
> end
>
> object O(m: String) extends {T}
> end
>
> I get this error: "Object O does not define method m()@... declared in
> T" and I have to add this to O:
>
> getter m(): String = m
>
> (and it works, although I seriously doubted before writing it).
>
> My question is whether, over the long term, it will work without
> declaring the getter in O. I know that getters are not fully
> implemented yet, but I don't know exactly how this will work.

Currently, "getter" doesn't have any actual meaning, which is why we  
have the problem you report.  However, we intend that it will have  
meaning, changing the syntactic form of the call so that you don't  
need (and indeed, must not have) the parentheses.  When that is  
fixed, the problem you see above should also be fixed, so that the  
first program above should be legal.

- Victor


Gmane