>> * better support for hierarchies (i.e. Os::Current could be "macos", but
>> would match "darwin"). one can easily introduce an overload for "macos"
>> later
>> * tag dispatching composes quite nicely
> 
> Can we have more examples of how tag dispatching would be useful?
> 
> Because this is a design question for the API: do we need a tag in the first
> place? Or just a set of booleans?
the tag is always a quality-of-life feature. it won't harm to also have 
booleans.

an example how they compose:
```
void foo(Os::UnixT);
void bar(Os::UnixT);
void bar(Os::DarwinT);

template <typename OsType)
void fooAndBar(OsType os)
{
     foo(os);
     bar(os);
}
```

one other example where i found tags useful is when the os that one 
targets, does not need to be the "current" os. it is not a common use 
case, though:
```
void parseBinaries(string os)
{
     if (os == "linux")
         parseBinaries(Os::Linux);
     else if (os == "macos")
         parseBinaries(Os::MacOS);
     [...]
}
```


-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to