Avoid duplicating `Gate`
Closed this issue · 1 comments
eelstork commented
Does not impact functionality, but we have 2-3 implementations of gate and status ref which are very closely related.
Right now it is not obvious whether this can be done or not, because null-conditional decorators rely on typing, and how far generification can help with this is unclear.
Generic gate:
namespace Active.Core{
public readonly struct Gate<T> where T : AbstractDecorator{
readonly T owner; readonly LogData logData;
internal Gate(T owner, LogData logData)
{ this.owner = owner; this.logData = logData; }
public StatusRef this[status s]{ get{
#if !AL_OPTIMIZE
owner.target = s.targetScope;
#endif
owner.OnStatus(s);
return new StatusRef(s, logData);
}}
}}
Works when moving target
and a couple other things to AbstractDecorator
, however type dependency on StatusRef
, which may be touchier.
eelstork commented
Closing; not something broken, unclear benefits