Overloading based on attributes - is it a good idea?

aliak something at something.com
Wed May 29 12:39:16 UTC 2019


On Wednesday, 29 May 2019 at 02:45:37 UTC, Jonathan Marler wrote:
> On Wednesday, 29 May 2019 at 01:14:04 UTC, Walter Bright wrote:
>> [...]
>
> Well, I didn't propose an algorithm.  I was just providing a 
> visual aid to your graph analogy. My suggesion has nothing to 
> do with attribute inference on templates.  If it did then you 
> are completely right that this would be a combinatorial 
> explosion.  The idea is actually pretty "dumb" at its core.  
> What's the simplest way to pass this information to a template?
>  Just add a template parameter.
>
> [...]

Doesn't Jai do something similar to this? I.e. it passes in the 
"context" of the caller so that you can alter your code on what 
the environment is outside the function. So the context would 
could be a struct

struct Conctext {
   bool isNogc; bool isSafe; // etc...
}

It's be akin to introducing the concept of a "compile time this" 
isn't it?


More information about the Digitalmars-d mailing list