Re: [w3c/manifest] Drop WebIDL enums (#899)

Hi @annevk . The Infra [convert a JSON-derived JavaScript value to an Infra value](https://infra.spec.whatwg.org/#convert-a-json-derived-javascript-value-to-an-infra-value) is necessary but not sufficient, as it's dynamically typed. It will take any valid JSON and convert it into an Infra value, but as far as I can tell, has no schema and no way of checking that the input JSON corresponds to a particular "type signature" (i.e., well-defined data structure). I guess that's what you're trying to cover with whatwg/infra#159. In the interum, I have to check all that myself with prose.

> I'm not entirely convinced it's needed as it seems pretty easy to reject/accept things in prose.

It's "easy" to do in small quantities. It makes it harder to read the overall spec, though, especially when you have a JSON structure as large and complex as that of the Manifest format. I'm really happy with being able to look at [this WebIDL](https://www.w3.org/TR/appmanifest/#webappmanifest-dictionary) and tell at a glance what type is required for each of those fields. It would be much less readable if I had to navigate to the parsing algorithm for each field and then inspect the prose text within to find out what assertions are being made about the data in there, to infer what type is being expected for that field.

I'm not wedded to WebIDL. I just would like some declarative schema language as opposed to manual parsing code.

@marcoscaceres yes, Chromium and Firefox both parse the structure with code, but that isn't particularly readable either, and ideally those implementations would be refactored to parse them using a declarative structure. Either way, it should not stop the specification from being more readable than the code that implements it.

> Perhaps a list of use cases or scenarios would help there.

The use case is simply the need to express the type requirements of the Web App Manifest JSON structure: https://www.w3.org/TR/appmanifest/#webappmanifest-dictionary

Currently it is expressed in WebIDL, which clearly communicates the type of everything, but _doesn't_ communicate what should happen in the event of a type error. Ideally we would be able to fix that problem without making the text less readable and maintainable.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/pull/899#issuecomment-643885069

Received on Monday, 15 June 2020 03:39:04 UTC