sbcl / specializable

generalized specializers work
13 stars 2 forks source link

Tiebraking in accept specializer #5

Closed scymtym closed 10 years ago

scymtym commented 10 years ago

I would like to resolve the tiebraker TODO as follows:

I have implemented this and could push if the approach sounds reasonable.

csrhodes commented 10 years ago

Jan Moringen notifications@github.com writes:

I would like to resolve the tiebraker TODO as follows:

  • If the same media type entry is the best match for two specializers (e.g. request only has text/* and there are specializers text/plainandtext/html), usestring<` on the specializers' media type strings.
  • If two media types in the accept specification, that do not have a ancestor-descendent relation in the accept-tree, have the same q value, treat the media type that occurs earlier in the specification as preferred.

I have implemented this and could push if the approach sounds reasonable.

That's fine. I think for full industrial-grade productization, this could turn into a tiebreaker function per generic function, but this as a default strategy (and unparameterized for now) is absolutely fine.

Cheers,

Christophe