On Tue, Jan 17, 2017 at 9:52 PM, Fleshgrinder <p...@fleshgrinder.com> wrote:
> On 1/17/2017 9:48 PM, Nikita Popov wrote: > > Without putting a lot of though into this, the restriction sounds > > reasonable. > > > > However, it is not immediately clear to me how this can be implemented > > without adding a disproportionate amount of overhead for something which > I > > would consider a rather minor feature. If an object only had a single > > constructor this would be a simple flag, but if you want to allow one > call > > per each constructor in the hierarchy (i.e. you can call the constructor > > and each parent constructor once), this information needs to be stored > > somehow. The obvious way would be a hashset containing the constructors > (or > > CEs) that have been called on the object, but I don't think this would be > > acceptable. > > > > Regards, > > Nikita > > > > Hey Nikic! > > Thanks for skimming over it. I also though about implementation already. > My initial though was -- especially to keep it simple -- to simply > delete the method from the object's table. > > Not sure if this is possible or just introduced more problems than it > solves. Also considering that we think reflection should continue to > allow calling it multiple times, though this is obviously still debatable. > Methods are stored on the class, with the object containing a pointer to the class. As such, it's not possible to delete a method from a single object, you can only delete a method from the entire class. (In practice you can't do that either ^^) Nikita