Re: [netmod] rfc6991-bis: "token" type?

Andy Bierman <andy@yumaworks.com> Tue, 23 April 2019 01:43 UTC

Return-Path: <andy@yumaworks.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6CCEE1202E7 for <netmod@ietfa.amsl.com>; Mon, 22 Apr 2019 18:43:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 HVTsilhGuzTF for <netmod@ietfa.amsl.com>; Mon, 22 Apr 2019 18:43:37 -0700 (PDT)
Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 778D61202C6 for <netmod@ietf.org>; Mon, 22 Apr 2019 18:43:36 -0700 (PDT)
Received: by mail-lj1-x22b.google.com with SMTP id f18so11910043lja.10 for <netmod@ietf.org>; Mon, 22 Apr 2019 18:43:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ADed/LAkxWvAm4wJ2hyBgpe5Swevs0RgU8CQEWGGeqY=; b=1tQGaVTkixh+CaW/8XAUSVjAe0jb2roU1Skdhnzn6l9dJSLwp21TmVYd+5jrcL+7Cr 7paDNWmj2miLBU53YqI5LIGA5bjexHaNCE0R8/HAy1zGU7snFvs4sqhPmi0zY3JzMCVF /cHYF27Unf82hdWrWNDgi/2mWCJqfAOQNXvzAv1ZuIh4ETUpdpEGT//ow9zalbkCnGJ4 snyByWKERjxugKIWMf5a/53UCn6KQg9zeacjuzcQw/CTG6J6A/WBqeMbw46oaVuOduPq GJMPUriOWQzF3T7ry4cB0sOYpflSO1j1DnKpvoeBqPqtuz1Rety9/9/DIoE6aqLCf4X0 +HMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ADed/LAkxWvAm4wJ2hyBgpe5Swevs0RgU8CQEWGGeqY=; b=uNOO7FwskKTW8Y99rDcleKmMDCNQLkYeUqzDlSs+jJeyJFQUKDhsDXD+42Cp0SkYzl PLB+d5Wa61RyKoAjdXVBZhXOZl0Zl1VC9eRWByGFdoTsoiWwgmyAjQUgIGa+N7a+MIzH Rgv4WzxC+tnXcVv9U5FP1q/vwOp72K+Z045BbJ0Tt3r+IWrhYSHoceNAD0+T+Jeq7BsM /1vomAjWtsy8g1bKuXq3XRQ/N9GM+uZkP6M/K0zIP4HPVpuoeLN3Fv2QjIwb5LE807gE m+0nM67PE+b9X7BXwRsL7J0QFNNI7IZpNWE7QZ3skxVSLSt6HuBfidk8+hW6oJFuD6by iA1Q==
X-Gm-Message-State: APjAAAV901vK5RftzXIB5r78tr2Ivsl8cssEm3x/TVhXx0qO8A4bKzxd K/Klgax5rRlb/o1DqZ2No4g1CKW/RDywNPgtoSRbA2QleOn1MA==
X-Google-Smtp-Source: APXvYqweVHp1h1rgiA0iVRNAYgbKvortMXU5ajxm5gc43B5xLX/SG5WD7r2zcZWl7zibE2o5iKULU/78pGqf+hwcwgE=
X-Received: by 2002:a2e:9e4d:: with SMTP id g13mr11987009ljk.12.1555983814479; Mon, 22 Apr 2019 18:43:34 -0700 (PDT)
MIME-Version: 1.0
References: <155535446032.10827.9204466950651701790@ietfa.amsl.com> <0100016a2ec8ed5f-14648cab-7615-4af4-9131-e85bf5826a03-000000@email.amazonses.com> <20190421144028.2pijzyloxxh77eix@anna.jacobs.jacobs-university.de> <0100016a46b54f44-ec6dd09f-f63b-48ee-914d-9718b27b0dc2-000000@email.amazonses.com>
In-Reply-To: <0100016a46b54f44-ec6dd09f-f63b-48ee-914d-9718b27b0dc2-000000@email.amazonses.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Mon, 22 Apr 2019 18:43:23 -0700
Message-ID: <CABCOCHRi4xCebGjy1Cr7mwBHjzSPsEHTTVU=ZBTYHMWj0sJfKQ@mail.gmail.com>
To: Kent Watsen <kent+ietf@watsen.net>
Cc: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, "netmod@ietf.org" <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000089efa7058728b660"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/MXbI8NJFeoSVJ4md9h56HtScQdA>
Subject: Re: [netmod] rfc6991-bis: "token" type?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 23 Apr 2019 01:43:46 -0000

On Mon, Apr 22, 2019 at 1:21 PM Kent Watsen <kent+ietf@watsen.net> wrote:

> Hi Juergen,
>
>
> can you provide examples where this particular type is useful?
>
>
> Useful in many contexts.  For instance:
>
>     list user {
>       key name;
>       leaf name {
>         type string;
>       }
>       leaf password {
>         type string;
>       }
>
>

Why would type string be used?

    list user {
      key name;
      leaf name {
        type yang:yang-identifier;
      }
      leaf password {
        type iana:crypt-hash;
      }
  }

Still not clear on the use-cases for a token data type.


Andy


> The following instance document is valid:
>
>   <user>
>     <name/>
>     <password/>
>   </user>
>
> Adding pattern statements works, but gets old after awhile.  A built-in
> type would be helpful.
>
>
> Or were
> you generally looking for a type to name things and the XSD token type
> was the first one that came your mind?
>
>
> Yes, from past-life experience with XSD, I found "token" and
> "normalizedString" useful (
> https://www.w3schools.com/XML/schema_dtypes_string.asp).   However, those
> types
> do not fully express what I really want (including, e.g., non-empty),
> which is:
>
> a) a type for a non-empty, stripped, printable string that MAY contain
> internal 'space' characters.
>
> b) a type for a non-empty, stripped, printable string that MAY NOT contain
> internal 'space' characters.
>
> /kw
>
>
> If the goal is to define a type for identifiers, then we likely should
> follow the Unicode standard annex UAX-31 and make use of <XID_Start>
> <XID_Continue>, which is what I think Python3 and Rust are using as
> the basis for their notion of language identifiers (but then the
> Unicode definitions are also criticized as buggy). A challenge is that
> the definition of <XID_Start> and <XID_Continue> seems to evolve with
> the unicode version. And once you start digging into the various
> attempts of modern programming languages to support internationalized
> identifiers, you discover that this is far from trivial to get right.
>
> /js
>
> On Thu, Apr 18, 2019 at 04:51:21AM +0000, Kent Watsen wrote:
>
>
> Many times in models I want a non-empty version of what XSD calls a
> "token":
>
>    token    A string that does not contain line feeds,
>             carriage returns, tabs, leading or trailing
>             spaces, or multiple spaces.
>
> So how about the following?
>
>  typedef token {
>      type string;
>      length "1.max";         // non-empty (some expr do this already)
>      pattern "[^\n\r\t"]+"   // no LFs, CRs, or Tabs
>      pattern "[^ ].*";       // no leading space     (min-length 1?)
>      pattern ".*[^ ]";       // no trailing space    (min-length 1?)
>      pattern ".*[^ ][^ ].*"  // no multiple spaces   (min-length 2?)
>  }
>
> Kent // contributor
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
>
> --
> 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/>
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>