Let me preface this comment by saying that I understand fully that this proposal is setting a floor on allowable characters, not a ceiling. That being said, I still don't understand the purpose behind specifying it as proposed:
"MUST support identifiers consisting of the characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding and a length of up to 64 characters" Larry's explanation behind this change was to mandate: "if all you support is basic ASCII, that's not enough." However, this proposed wording still allows just that, as all the defined required characters are in ASCII and their UTF-8 encoding is the same as their ASCII encoding. In other words, even with the additional wording here, I can still write a conforming container that only supports ASCII identifiers. Unless I was writing a _very_ restrictive container as to characters (that for example only allows uppercase Latin letters) the only effective change here is the requirement to allow at least 64-character-long identifiers. Even that length limit is a little ambiguous, I think. If I restrict to just the minimal set of required characters, I can limit the string length to 64 bytes and always safely fulfill the length requirement. However, if I allow all of UTF-8, am I then required to use multibyte string length comparison so that 64 _characters_ is still the limit? I suppose I can instead decide to increase the limit to 256 bytes and still be in compliance. In sum, my objection is this: while it sets some restrictions on what containers can do, the proposed limitation really does too little (for example, it doesn't solve the "pizza emoji" problem). If I as a user actually want the compatibility as now guaranteed by the standard, I'm limited to using only the quite small minimal required set of characters. Additionally, the very act of setting any minimum at all makes it more likely that future implementations align with that minimum, simply because it's an easy way to make a decision. If anything, I think this wording codifies the idea of an ASCII-only container rather than providing any meaningful restriction. I think it would be wise to either significantly raise the "floor" on allowed characters if one must be specified, or alternatively jettison the limitation entirely. The idea of a length requirement is fine, but it seems to me that it would be simpler to define it in terms of bytes rather than characters, given the allowance for multiple character sets. -John Flatness On Saturday, November 12, 2016 at 9:01:00 PM UTC-5, Larry Garfield wrote: > > I filed a PR here with my recommendation: > > https://github.com/php-fig/fig-standards/pull/837 > > Thanks. > > --Larry Garfield > > On 11/11/2016 12:43 PM, Matthieu Napoli wrote: > > Hi Larry, you are right, let's move forward: what sentence do you suggest > we should add to the spec? > > Matthieu > > Le 11 novembre 2016 à 17:48:54, Larry Garfield ([email protected] > <javascript:>) a écrit: > >> To reiterate what I said before: I am mostly suggesting a *lower bound*, >> not *upper bound*. As PSR-6 states: >> >> " A string of at least one character that uniquely identifies a cached >> item. Implementing libraries MUST support keys consisting of the >> characters A-Z, a-z, 0-9, _, and . in any order in UTF-8 encoding and a >> length of up to 64 characters. Implementing libraries MAY support >> additional characters and encodings or longer lengths, but must support at >> least that minimum." >> >> And then it also has 8 reserved characters. With the exception of the >> reserved punctuation marks (which as I said are highly debatable for >> PSR-11), it does not limit at all the keys that can be used; it's exactly >> the opposite. >> >> Vis, I am in no way suggesting the spec should say "UTF-32 characters are >> illegal." I am saying the spec should say "if all you support is basic >> ASCII, that's not enough." >> >> I admit to being quite confused as to how this is a controversial >> suggestion, and why people keep misinterpreting it as suggesting to heavily >> restrict legal key values. >> >> --Larry Garfield >> >> On 11/11/2016 05:02 AM, Gary Hockin wrote: >> >> This, as in the shared containers thread, is surely an implementation >> detail rather than part of the standard? It would be a shame to limit use >> of the standard by restricting which character sets are acceptable based on >> nominal research by people in the western world (I mean this in terms of >> character sets rather than social or political). >> >> G >> >> On Thursday, November 3, 2016 at 7:36:58 PM UTC, Matthew Weier O'Phinney >> wrote: >>> >>> >>> >>> On Thu, Nov 3, 2016 at 9:41 AM, Larry Garfield <[email protected]> >>> wrote: >>> >>>> I disagree for exactly that reason. :-) >>>> >>>> If the goal is interoperability, then containers need to have at least >>>> a common baseline of what they should allow. It's essentially an >>>> additional layer of type checking beyond just "string". That doesn't mean >>>> it has to specify a dot-delimited format, or require/disallow /, or >>>> whatever. Just the legal world of opaque strings. >>>> >>> >>> I disagree. We didn't specify beyond the string type in PSR-7 for any of >>> the various properties that represented lookup tables (attributes, server >>> params, cookies, query params, etc); doing so is essentially unnecessarily >>> verbose, when "non-empty string" essentially implies it's up to the user to >>> determine what keys are valid and what are not, with the baseline >>> assumption that *any* can be used. >>> >>> I've played with a fair number of containers at this point, and, >>> honestly, I cannot think of *any* that had restrictions on characters. In a >>> worst case scenario, the lookup will fail. For containers with sets of >>> reserved characters, they can normalize before lookup and/or injection. >>> >>> Swapping containers is usually not something done lightly, and I would >>> expect that if an implementation has a more restrictive set of characters >>> allowed, that would be a consideration in the choice when switching. >>> >>> >>> I believe PSR-6's definition allows any UTF-8 character, so that would >>>> include pizza emoji. :-) However, if I'm trying to connect two containers >>>> (for delegation), and one uses a pizza emoji and the other only allows >>>> ASCII characters, then they're not actually compatible. (Or, god forbid, >>>> one tries to use Windows-1252 for some ungodly reason.) Or perhaps one is >>>> limited to only 5 character strings for some reason (stored in a database >>>> column)? Then passing in a longer string wouldn't work. >>>> >>>> PSR-6's requirement was simply "at leas a 64 character UTF-8 string, >>>> and these chars are reserved". If you don't want to reserve the same/any >>>> characters that's fine, but at least a character encoding and minimum >>>> legal >>>> length should be specified. >>>> >>>> --Larry Garfield >>>> >>>> >>>> On 11/03/2016 03:47 AM, David Négrier wrote: >>>> >>>> I agree with Matthieu. >>>> >>>> Specifying what legal characters are supported definitely belongs to >>>> another PSR (the one where we put things into the container). I'll propose >>>> a PR in container-interop/service-provider >>>> <https://github.com/container-interop/service-provider/> to define >>>> precisely the allowed identifiers. >>>> >>>> Unlike PSR-6, there is no "set" in this PSR, therefore no need to >>>> standardize the acceptable identifiers. For PSR-11, if the identifier >>>> passed is "🍕" (the pizza slice emoji) and the container does not support >>>> emoji identifiers (what a shame! :) ), the container should return a >>>> NotFoundException. >>>> >>>> David. >>>> >>>> >>>> >>>> Le mercredi 2 novembre 2016 22:49:33 UTC+1, Matthieu Napoli a écrit : >>>>> >>>>> Splitting of the main thread, quoting Larry: >>>>> >>>>> > The spec should specify what legal characters are for an entry >>>>> identifier, and what if any reserved characters there are. It should >>>>> also specify minimum supported key length and character sets, for >>>>> completeness. I recommend borrowing PSR-6's language here, which I >>>>> believe addresses this area well. Whether it uses the same reserved >>>>> character list or another one I don't feel strongly about. I would not >>>>> consider this a Review-breaking change. >>>>> >>>>> Why should we specify that? This is explicitly a "non-goal" of PSR-11: >>>>> https://github.com/php-fig/fig-standards/blob/master/proposed/container-meta.md#32-non-goals >>>>> >>>>> > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/b9b2ef01-c85f-442f-ac87-7b150faa0608%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
