dret / I-D

Internet Drafts I've authored or contributed to.
16 stars 13 forks source link

are target attributes key/value pairs or key/string-value pairs #77

Closed dret closed 7 years ago

dret commented 7 years ago

as discussed in #73 and #74, there are specific questions about defined target attributes and extension target attributes. a more fundamental question underlying these questions is whether there is a general "pattern" that the spec follows for what target attributes look like. the current draft (and as discussed in https://github.com/dret/I-D/issues/74#issuecomment-321654863) suggests that all target attributes are key/string-value pairs. this implies that rel will not be an array (#73), and that extension target attributes are always represented as strings (#74). the argument for such a model could be that the processing of unknown link parameters then would be well-defined (#76), and therefore it would be possible to write generic link processing agents that would not need specific knowledge of JSON serializations of link parameters. the counter-argument could be that this makes it harder to process some link parameters and forces them to use microsyntaxes, such as whitespace-separated lists (rel). another counterargument would be that for repeatable target attributes, it still would need to be defined how to serialize them into JSON (as mentioned in https://github.com/dret/I-D/issues/76#issuecomment-322577333).

asbjornu commented 7 years ago

…it would be possible to write generic link processing agents that would not need specific knowledge of JSON serializations of link parameters.

I find this to be a bit of a weak argument, considering that the format itself is JSON. It should therefore be trivial to parse any value as a JSON token and convert it from that into a JSON string, number, object, array or whatnot. Most, if not all, JSON parsers have this functionality built in.

Considering that it is only when the attribute is known that its value needs to be converted from a token to a more specific type, I don't feel like this is a show stopper.

dret commented 7 years ago

On 2017-08-15 14:42, Asbjørn Ulsberg wrote:

…it would be possible to write generic link processing agents that
would not need specific knowledge of JSON serializations of link
parameters.

I find this to be a bit of a weak argument, considering that the format itself is JSON. It should therefore be trivial to parse any value as a JSON |token| and convert it from that into a JSON |string|, |number|, |object|, |array| or whatnot. Most, if not all, JSON parsers have this functionality built in.

yes, you could parse everything as JSON, either in the key/value or in the key/string-value case. the question is about the balance between a "generic structure" and "specific serialization optimizations". i am not claiming that either way does not work. there are just different implications in terms of what you can implement, in particular for generic components that will not know all link parameters that they are processing (see #76).

dret commented 7 years ago

this topic can be closed based on the general syntax resolution of #74. in this new model, target attributes are: