FAQ
Hi All,

While reviewing a fix to my Test-(CPAN|JSON|YAML)-Meta distributions,
regarding optional_features, it was questioned what the key name in each
map should be. Below is an excerpt of a discussion between Kevin Ryde
and myself, via the RT#52685 [1]

[1] http://rt.cpan.org/Public/Bug/Display.html?id=52685

From: Kevin Ryde via RT <bug-Test-YAML-Meta@rt.cpan.org>

"Barbie via RT" <bug-Test-YAML-Meta@rt.cpan.org> writes:
Although not explicitly stated in the current specifications (v1.0 -
v1.4), the convention has been to precede user defined keys with
"[xX]_".
That doesn't sound right for the optional features names. The effect
would be that anything is allowed in lower case, but if you want upper
case you must write x_.

That x_ bit is for extensions to maps with spec-defined keys isn't it?
In the optional features names there isn't anything spec-defined, it's
all user-defined names, and you're free to write anything, isn't it?

Either way it would help for the spec to say something there, as I can't
imagine I'll be the last to wonder what it is or isn't supposed to be.

as defined in the current blead version of v2.0 of the specification:
Sounds a bit dangerous to enforce future spec against META.yml's which
only declare themselves as 1.4 or whatever.

But my reading of that x_ would be that in 1.4 no unknown keys are
allowed (toplevel, requires maps, etc), but 2.0 allows unknown keys if
they begin x_, ie. a loosening ...

----- End forwarded message -----

Although the convention for the X_ naming is only stated in v2.0, it has
been discussed before and been considered acceptable. However, I think
Kevin makes a good point as to whether this should be backported.
Thoughts welcome.

Kevin also makes a good point regarding what characters should be
allowable in an optional feature key name. Currently there is no
specific mention of how optional features should be named (lower case?
preceding X_? any value in the character class \w?).

What would be the recommended naming convention for optional features?


Cheers,
Barbie.
--
Birmingham Perl Mongers <http://birmingham.pm.org>
Memoirs Of A Roadie <http://barbie.missbarbell.co.uk>
CPAN Testers Blog <http://blog.cpantesters.org>
YAPC Conference Surveys <http://yapc-surveys.org>

Search Discussions

  • David Golden at Dec 15, 2009 at 2:00 pm

    On Tue, Dec 15, 2009 at 6:10 AM, Barbie wrote:
    Although not explicitly stated in the current specifications (v1.0 -
    v1.4), the convention has been to precede user defined keys with
    "[xX]_".
    That doesn't sound right for the optional features names.  The effect
    would be that anything is allowed in lower case, but if you want upper
    case you must write x_.

    That x_ bit is for extensions to maps with spec-defined keys isn't it?
    In the optional features names there isn't anything spec-defined, it's
    all user-defined names, and you're free to write anything, isn't it?
    Part of what is taking me a while to synthesize the 2.0 draft spec
    (apart from life kicking my ass lately), is that I'm trying to be
    formal about every data type so we can actually do a better job of
    validation, and doing those definitions requires a bit of thought and
    care. Just as for prerequisites where the 'keys' are module names,
    for optional features the keys will be something that does not need a
    leading "x_". Right now, the draft says "an identifier" and that
    term could be defined further.

    -- David
  • Zefram at Dec 15, 2009 at 2:32 pm

    David Golden wrote:
    Right now, the draft says "an identifier" and that
    term could be defined further.
    I take "identifier", without further explanation, to mean
    /[A-Za-z_][0-9A-Za-z_]*/. Not anything involving \w, note.

    -zefram
  • Barbie at Dec 16, 2009 at 2:01 pm

    On Tue, Dec 15, 2009 at 02:32:42PM +0000, Zefram wrote:
    David Golden wrote:
    Right now, the draft says "an identifier" and that
    term could be defined further.
    I take "identifier", without further explanation, to mean
    /[A-Za-z_][0-9A-Za-z_]*/. Not anything involving \w, note.
    I would prefer to keep it simple like this too.

    Cheers,
    Barbie.
    --
    Birmingham Perl Mongers <http://birmingham.pm.org>
    Memoirs Of A Roadie <http://barbie.missbarbell.co.uk>
    CPAN Testers Blog <http://blog.cpantesters.org>
    YAPC Conference Surveys <http://yapc-surveys.org>
  • David Golden at Dec 16, 2009 at 3:54 pm

    On Wed, Dec 16, 2009 at 9:01 AM, Barbie wrote:
    On Tue, Dec 15, 2009 at 02:32:42PM +0000, Zefram wrote:
    David Golden wrote:
    Right now, the draft says "an identifier" and that
    term could be defined further.
    I take "identifier", without further explanation, to mean
    /[A-Za-z_][0-9A-Za-z_]*/.  Not anything involving \w, note.
    I would prefer to keep it simple like this too.
    If I created an "Identifier" type with that specification, would that suffice?

    Does anyone want to bikeshed the name or regex before I add it?

    David
  • Barbie at Dec 16, 2009 at 4:12 pm

    On Wed, Dec 16, 2009 at 10:54:47AM -0500, David Golden wrote:
    On Wed, Dec 16, 2009 at 9:01 AM, Barbie wrote:
    On Tue, Dec 15, 2009 at 02:32:42PM +0000, Zefram wrote:
    David Golden wrote:
    Right now, the draft says "an identifier" and that
    term could be defined further.
    I take "identifier", without further explanation, to mean
    /[A-Za-z_][0-9A-Za-z_]*/.  Not anything involving \w, note.
    I would prefer to keep it simple like this too.
    If I created an "Identifier" type with that specification, would that suffice?
    Works for me :)
    Does anyone want to bikeshed the name or regex before I add it?
    A #8a2be2 one will do nicely thanks ;)

    Cheers,
    Barbie.
    --
    Birmingham Perl Mongers <http://birmingham.pm.org>
    Memoirs Of A Roadie <http://barbie.missbarbell.co.uk>
    CPAN Testers Blog <http://blog.cpantesters.org>
    YAPC Conference Surveys <http://yapc-surveys.org>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcpan-workers @
categoriesperl
postedDec 15, '09 at 11:11a
activeDec 16, '09 at 4:12p
posts6
users3
websitecpan.org

3 users in discussion

Barbie: 3 posts David Golden: 2 posts Zefram: 1 post

People

Translate

site design / logo © 2018 Grokbase