Error in using 'delete' keyword in enum in idl

23 views
Skip to first unread message

pal...@chromium.org

unread,
Jun 10, 2016, 7:35:01 PM6/10/16
to platform-architecture-dev, Daniel Murphy
I need to use the 'delete' keyword in my record type enum for IndexedDb Observer idl.    ( https://github.com/dmurph/indexed-db-observers/blob/gh-pages/EXPLAINER.md#records ).
Howver adding 'delete' to IndexdDbNames.in https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/indexeddb/IndexedDBNames.in  leads to generating an identifier called delete. 
This conflicts with delete being a keyword in C++ . 
Could anyone please help with this.
+dmuprh

Daniel Murphy

unread,
Jun 10, 2016, 7:38:26 PM6/10/16
to pal...@chromium.org, platform-architecture-dev, esp...@google.com, jyas...@google.com
+Elliott Sprehn +jya...@google.com Dana says there was a discussion about enum style. Maybe the bindings could expect/generate this style for the C++ side here? This would avoid keyword conflicts.

Daniel Murphy

unread,
Jun 10, 2016, 8:29:55 PM6/10/16
to pal...@chromium.org, platform-architecture-dev, esp...@google.com, jyas...@google.com
Based on make_names.py (which is the python script for this file. this differs between .in files), you can set the ImplementedAs= property? so do:

delete ImplementedAs=kDelete

We should probably change all of the them but that should be in a different patch.

Elliott Sprehn

unread,
Jun 11, 2016, 3:51:03 AM6/11/16
to Daniel Murphy, Jeffrey Yasskin, platform-architecture-dev, pal...@chromium.org

Yeah we should rename all the enums in blink to kCamelCase style. The code generator should handle any fancy mappings.

Ian Clelland

unread,
Jun 11, 2016, 10:35:24 AM6/11/16
to Elliott Sprehn, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin

The enum problem bit me yesterday, trying to add a new SHOUTY_CASE IDL constant. Blink style checks really don't like that. Perhaps if I have some time on a flight to Munich tomorrow I'll take a look at renaming them.

I do think the original issue is solvable with the ImplementedAs IDL attribute, though. I had to do the same thing with the 'register' method on SyncManager: (https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/background_sync/SyncManager.idl)

--
You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architect...@chromium.org.
To post to this group, send email to platform-arc...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/platform-architecture-dev/CAO9Q3i%2BfAF-_gyU6sJXQ39fjhtqQUaM57GZ%2BcUWfLvCfT4ZuTQ%40mail.gmail.com.

Ian Clelland

unread,
Jun 23, 2016, 10:18:19 AM6/23/16
to Elliott Sprehn, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
I have a 90% mechanical CL to do this: replacing any all-caps IDL constants with kBlinkStyleConformant ones in the reflected C++ code. (The bindings generation code is updated to just generate the correct names; the other 10% of the CL is me verifying that my search+replace isn't being overzealous with things like comments, and updating ASSERTs when the style checker forces me to)

See https://codereview.chromium.org/2068053002/ if this still seems like a good thing to do.

Elliott Sprehn

unread,
Jun 23, 2016, 4:10:10 PM6/23/16
to Ian Clelland, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
I'm happy with that if other people are. It does diverge our code a bit from the web, but it makes all our constants consistent which is nice. In general I'd like to rename all of the enums in the codebase this way.

Kentaro Hara

unread,
Jun 23, 2016, 8:42:29 PM6/23/16
to Elliott Sprehn, Ian Clelland, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
I'm happy with the change.


Ian Clelland

unread,
Jul 26, 2016, 3:16:10 PM7/26/16
to Kentaro Hara, Elliott Sprehn, Ian Clelland, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
I haven't heard any objections to this plan in the last 30 days; I've been babysitting this CL, rebasing as necessary, for that time.

If no one else has any problems, then it sound like I should send out an announcement on blink-dev about the change and commit it.

Are there any other stakeholders I should reach out to first? Any other reasons to hold off on this any longer?

Thanks,
Ian

Kentaro Hara

unread,
Jul 26, 2016, 3:35:25 PM7/26/16
to Ian Clelland, Elliott Sprehn, Daniel Murphy, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
I think we can make the change now.

Daniel Murphy

unread,
Oct 19, 2016, 3:41:21 PM10/19/16
to Kentaro Hara, Ian Clelland, Elliott Sprehn, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
Digging this thread up because there's actually a problem with "ImplementedAs". It seems to change both the variable name AND the value of the enum we're using. So when we do:

delete ImplementedAs=kDelete

in IndexedDBNames.in, this generates

IndexedDBNames::kDelete in IndexedDBNames.h, but the value of this is 'kDelete', and I need it to be 'delete'.

Do we have a way of doing this?

Daniel

Daniel Murphy

unread,
Oct 19, 2016, 3:43:32 PM10/19/16
to Kentaro Hara, Ian Clelland, Elliott Sprehn, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
(sending from chromium address)

Digging this thread up because there's actually a problem with "ImplementedAs". It seems to change both the variable name AND the value of the enum we're using. So when we do:

delete ImplementedAs=kDelete

in IndexedDBNames.in, this generates

IndexedDBNames::kDelete in IndexedDBNames.h, but the value of this is 'kDelete', and I need it to be 'delete'.

Do we have a way of doing this?

Daniel Murphy

unread,
Oct 19, 2016, 3:44:21 PM10/19/16
to Kentaro Hara, Ian Clelland, Elliott Sprehn, platform-architecture-dev, pal...@chromium.org, Jeffrey Yasskin
Ah! I tried using

delete Symbol=kDelete

and that worked. Nevermind everyone!

Elliott Sprehn

unread,
Oct 19, 2016, 4:00:29 PM10/19/16
to Daniel Murphy, Ian Clelland, Kentaro Hara, platform-architecture-dev, Jeffrey Yasskin, pal...@chromium.org

Can you share your patch? I'm not sure I follow what you're doing here. :)


Ah! I tried using

To unsubscribe from this group and stop receiving emails from it, send an email to platform-architecture-dev+unsub...@chromium.org.
To post to this group, send email to platform-architecture-dev@chromium.org.

--
You received this message because you are subscribed to the Google Groups "platform-architecture-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to platform-architecture-dev+unsub...@chromium.org.
To post to this group, send email to platform-architecture-dev@chromium.org.



--
Kentaro Hara, Tokyo, Japan
Reply all
Reply to author
Forward
0 new messages