Re: [yang-doctors] guideline for enum and value?

"Acee Lindem (acee)" <acee@cisco.com> Wed, 14 February 2018 17:14 UTC

Return-Path: <acee@cisco.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1148212D77A for <yang-doctors@ietfa.amsl.com>; Wed, 14 Feb 2018 09:14:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.531
X-Spam-Level:
X-Spam-Status: No, score=-14.531 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NyuLPBRfyt2l for <yang-doctors@ietfa.amsl.com>; Wed, 14 Feb 2018 09:14:34 -0800 (PST)
Received: from alln-iport-4.cisco.com (alln-iport-4.cisco.com [173.37.142.91]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0DE3D12D777 for <yang-doctors@ietf.org>; Wed, 14 Feb 2018 09:14:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2374; q=dns/txt; s=iport; t=1518628474; x=1519838074; h=from:to:subject:date:message-id:references:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=04HkhrODW5dS3SDnxO1jUmcwtxbc42OCiLKfN1sDiBw=; b=FcZjFMk6kHEQdU03Ee5vgUk8Q55arfEW8/QrKE2IYr98oEqstOTa6o0A aoUt2oCQmk41cRpNREYvKStsepj/b0gN8XgBNQzn6Q90IUGX/aPpQ21JD Tr8McuO4qxRBBc9igWoUYM79XwP8gEiYrmFM7dC54e9KwZ6KTb3FYEOoM Y=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AwAQCpbYRa/4oNJK1aAxkBAQEBAQEBAQEBAQEHAQEBAQGDUmZwKAqDW4okjgOCAoEXlkKCGAoYC4UYAhqCY1QYAQIBAQEBAQECayiFJAEBAQIBAQEhEToZAgIBCA4CCgImAgICGQwLFRACBAESii0IEK9VgieEGAGEaIITAQEBAQEBAQEBAQEBAQEBAQEBAQEBGAUFgQqDc4IVg2iDBYMvAQGBcRcKJoJQMYIUIAWkLwkCjCaJXYIfikOHY4sUjFgCERkBgTsBHzmBUHAVPSoBghuEPAE6eIxNgRkBAQE
X-IronPort-AV: E=Sophos;i="5.46,513,1511827200"; d="scan'208";a="70837136"
Received: from alln-core-5.cisco.com ([173.36.13.138]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2018 17:14:33 +0000
Received: from XCH-RTP-007.cisco.com (xch-rtp-007.cisco.com [64.101.220.147]) by alln-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id w1EHEW3L004971 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 14 Feb 2018 17:14:32 GMT
Received: from xch-rtp-015.cisco.com (64.101.220.155) by XCH-RTP-007.cisco.com (64.101.220.147) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 14 Feb 2018 12:14:32 -0500
Received: from xch-rtp-015.cisco.com ([64.101.220.155]) by XCH-RTP-015.cisco.com ([64.101.220.155]) with mapi id 15.00.1320.000; Wed, 14 Feb 2018 12:14:31 -0500
From: "Acee Lindem (acee)" <acee@cisco.com>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, "Benoit Claise (bclaise)" <bclaise@cisco.com>, Martin Bjorklund <mbj@tail-f.com>, "Einar Nilsen-Nygaard (einarnn)" <einarnn@cisco.com>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>
Thread-Topic: [yang-doctors] guideline for enum and value?
Thread-Index: AQHTlbUkzfVXBtKozU2IeKLGGrnAZ6OEl/yAgAAF/4CAAANXAIAAFOWAgAALuwCAH7ajAIAABhwAgAADZ4D//8ELgA==
Date: Wed, 14 Feb 2018 17:14:31 +0000
Message-ID: <536ED657-C026-489C-B434-6CDAAF478A08@cisco.com>
References: <20180125.095921.224499312159563778.mbj@tail-f.com> <20180125091118.tjn5eiv2hzmc7k23@elstar.local> <dfb94426-c408-e215-e23b-539e127050a2@cisco.com> <20180125.120804.68412726225731762.mbj@tail-f.com> <0db2c4d1-ac4d-dcc6-b2b9-c580427a6a84@cisco.com> <20180214154740.l375k2kmodgvzvdx@elstar.local> <20180214155951.eqaskkjs67bt6zjc@elstar.local>
In-Reply-To: <20180214155951.eqaskkjs67bt6zjc@elstar.local>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.116.152.195]
Content-Type: text/plain; charset="utf-8"
Content-ID: <F8A8B8C6D986B34BACFEBB0D789CC2E0@emea.cisco.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/j2alRcsF36ETSsqlgD2x21ysoUA>
Subject: Re: [yang-doctors] guideline for enum and value?
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 14 Feb 2018 17:14:36 -0000

I agree. 

On 2/14/18, 11:00 AM, "yang-doctors on behalf of Juergen Schoenwaelder" <yang-doctors-bounces@ietf.org on behalf of j.schoenwaelder@jacobs-university.de> wrote:

    On Wed, Feb 14, 2018 at 04:47:40PM +0100, Juergen Schoenwaelder wrote:
      
    > > And:
    > > 
    > >  Do not use explicit 'value' statements, except if:
    > >     o the enum corresponds to some standard integer value, or
    > >     o you update the set of enums by inserting new enums in the middle of
    > > the list
    > 
    > I am not sure why we would recommend this.
    >
    
    More specifically, I do not see why
    
      type enumeration { enum foo { value 0; }; enum bar { value 1; }; }
    
    is to be avoided in favor of
    
      type enumeration { enum foo; enum bar; }
    
    given that they mean the same and the first one is explicit and robust
    to changes while the second one must be handled with care (only append
    enums, never reorder enums). Yes, clueful YANG authors can handle the
    later fine as they will understand that if order changes are needed,
    you have to move to explicit value assignments. My fear is that not
    all YANG authors will be aware of this (but then many of those authors
    likely also do not read guidelines).
    
    /js
    
    -- 
    Juergen Schoenwaelder           Jacobs University Bremen gGmbH
    Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
    Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
    
    _______________________________________________
    yang-doctors mailing list
    yang-doctors@ietf.org
    https://www.ietf.org/mailman/listinfo/yang-doctors