Self type

Cormac Flanagan cormac at soe.ucsc.edu
Tue Aug 14 09:48:20 PDT 2007



Peter Hall wrote:
>>> Or can't Self be used outside of the sorts of usage found in the
>>> proposal examples?
>> That's it.
> In that case, I think it needs to be clearer about how the syntax can
> be used. Is it only for use as the "this" parameter for function
> types? Seems to me like it should be usable anywhere that the compiler
> can reasonably detect the type at compile-time.
Yes, we plan to support Self in all reasonable places inside classes, 
interfaces, structural object types, and structural object expressions.
> 
> e.g.
> // this usage is handy for boiler-plate code that you can just copy
> // and paste without modification, or from an IDE code snippet template
> class A {
> var a:Self;
> // or...
> // var a:this type;
> }
> 
> type B = {b:Self};

Yes, I think this should be fine.

- Cormac



More information about the Es4-discuss mailing list