uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

Support immutable constants in the IDL

Open rfk opened this issue 5 years ago • 1 comments

For Nimbus, it would be useful to have the component export some constants for well-known server configurations like PRODUCTION and STAGING. It looks like WebIDL has some syntactic support for constants but they only exist as part of interfaces; you can also specify readonly namespace attributes which might be a better fit for our mis-use of WebIDL.

This issue is to investigate whether it's something we can support directly in uniffi in its current state, and propose an implementation if so.

┆Issue is synchronized with this Jira Task ┆Issue Number: UNIFFI-30

rfk avatar Oct 16 '20 00:10 rfk

A strawfox syntax would be something like:

namespace nimbus {
    readonly attribute RemoteSettingsConfig SERVER_PRODUCTION;
    readonly attribute RemoteSettingsConfig SERVER_STAGING;
}

Which is a bit awkward because of the way we abuse the namspace block, but may be workable for a first pass at this.

rfk avatar Oct 16 '20 00:10 rfk

Duplicate of #1480

-- Let's use the newer one for feature discussion.

badboy avatar Jun 14 '23 13:06 badboy