Overloading based on attributes - is it a good idea?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed May 29 05:29:30 UTC 2019


On Tuesday, 28 May 2019 at 22:33:46 UTC, aliak wrote:
> The thing you said about overloading on return types made me go 
> and check around a bit. I already knew that swift does this at 
> least. So I guess it isn't ambiguous since it's been 
> implemented. But maybe it has something to do with the type 
> system implementation they use?

It is possible, but when you have implicit type conversion... 
then you need to set up some strict presedence rules?

Overloading over inferred attributes can be solved by a SAT 
solver, AFAIK, but that would require very good heuristics to 
perform well. The problem is most likely not in that complexity 
class, but simpler.

Anyway, a solver can for each function find an expression for 
whether it is nogc or gc based on the ct parameters, so it is 
decidable. Same for nothrow.







More information about the Digitalmars-d mailing list