[webkit-dev] [Conditional=] vs. #if in IDL files

Ryosuke Niwa rniwa at webkit.org
Sat Mar 7 16:47:55 PST 2015


On Sat, Mar 7, 2015 at 8:55 AM, Darin Adler <darin at apple.com> wrote:

> Why do we have [Conditional=] in our IDL files? Perhaps because some ports
> lacked a way to do #if in the past?


I think Conditional is a nicer/newer way of if-defing based on feature
flags.


> Should we use #if or [Conditional]? See for example, HTMLMediaElement.idl,
> which has a mix of both styles. It's pretty ugly how the #if look in the
> IDL files, but even worse is a seemingly random mix of both #if and
> [Conditional].
>

We should use Conditional as much as possible.

As far as I know one area we can't use Conditional= is if something depends
on multiple feature flags or if it's specific to a binding language
(JS/Objective-C/etc...).  We should probably add a special feature flag for
that; e.g. Conditional=JS.

- R. Niwa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20150307/266468f3/attachment.html>


More information about the webkit-dev mailing list