flint icon indicating copy to clipboard operation
flint copied to clipboard

Support Self references in traits

Open franklinsch opened this issue 7 years ago • 3 comments

franklinsch avatar Jan 27 '18 11:01 franklinsch

This a subtask of #107 and #338.

franklinsch avatar Jan 27 '18 11:01 franklinsch

Is this done? We have protection blocks with self, and function calls don't need it. Without adding properties I can't think of any other uses.

bearbin avatar Sep 21 '18 09:09 bearbin

It's for parameters, where you don't want to support arbitrary traits conforming to it, but specifically the one that is being initialised e.g.

struct trait Asset {
  associatedtype RawType

  // Create the asset by transferring a given amount of asset's contents.
  init(from other: inout Self, amount: RawType)
}

DJRHails avatar Sep 21 '18 10:09 DJRHails