Re: [Cbor] CDDL Module Design

Michael Richardson <mcr+ietf@sandelman.ca> Wed, 01 July 2020 03:54 UTC

Return-Path: <mcr+ietf@sandelman.ca>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 973BF3A0AFD for <cbor@ietfa.amsl.com>; Tue, 30 Jun 2020 20:54:06 -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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 3b4Y1jzRaa7u for <cbor@ietfa.amsl.com>; Tue, 30 Jun 2020 20:54:03 -0700 (PDT)
Received: from tuna.sandelman.ca (tuna.sandelman.ca [IPv6:2607:f0b0:f:3:216:3eff:fe7c:d1f3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 66BEA3A0A79 for <cbor@ietf.org>; Tue, 30 Jun 2020 20:54:03 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by tuna.sandelman.ca (Postfix) with ESMTP id A60A1389BA; Tue, 30 Jun 2020 23:51:14 -0400 (EDT)
Received: from tuna.sandelman.ca ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SJVPiwIaMbjV; Tue, 30 Jun 2020 23:51:13 -0400 (EDT)
Received: from sandelman.ca (obiwan.sandelman.ca [IPv6:2607:f0b0:f:2::247]) by tuna.sandelman.ca (Postfix) with ESMTP id 2923C389B2; Tue, 30 Jun 2020 23:51:13 -0400 (EDT)
Received: from localhost (localhost [IPv6:::1]) by sandelman.ca (Postfix) with ESMTP id 5EF3E1F9; Tue, 30 Jun 2020 23:54:00 -0400 (EDT)
From: Michael Richardson <mcr+ietf@sandelman.ca>
To: Jim Schaad <ietf@augustcellars.com>
cc: cbor@ietf.org
In-Reply-To: <03c701d64f41$e1763fa0$a462bee0$@augustcellars.com>
References: <03c701d64f41$e1763fa0$a462bee0$@augustcellars.com>
X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 26.1
X-Face: $\n1pF)h^`}$H>Hk{L"x@)JS7<%Az}5RyS@k9X%29-lHB$Ti.V>2bi.~ehC0; <'$9xN5Ub# z!G,p`nR&p7Fz@^UXIn156S8.~^@MJ*mMsD7=QFeq%AL4m<nPbLgmtKK-5dC@#:k
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-="; micalg="pgp-sha512"; protocol="application/pgp-signature"
Date: Tue, 30 Jun 2020 23:54:00 -0400
Message-ID: <24433.1593575640@localhost>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/Hj3so_k_z8xaM6oWELtsgLDxpkI>
Subject: Re: [Cbor] CDDL Module Design
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 01 Jul 2020 03:54:07 -0000

Jim Schaad <ietf@augustcellars.com> wrote:
    > 1.  What is the naming scheme to be used?  Both XML Schema and ASN.1 use
    > unique identifiers for a module.  The problem with this approach is that a
    > revised module has a new identifier even if all of the changes were
    > preserving of the old module.  This can also present problems if two
    > different versions of the same module are used as it can be difficult to
    > know which version of a module is being provided.

Doesn't the version problem also include the "DLL hell" problem?
That is:
     module A includes module B.1 which includes C.1
            A includes module D.1 which includes C.2

and who knows if C.1 and C.2 can be used at the same time?

So I totally agree that this is a problem.

    > I think therefore it
    > would be nice to have a naming system that recognizes version numbers, but
    > can be used with a "latest version" mode.  One possible way to do this would
    > be to use a query parameter to get a specific version of a module while
    > without the query parameter the compiler grabs the most recent version it
    > has.

I think that this is probably a very elegant solution.

    > 2.  Do want the naming scheme to be used to access a module name from the
    > web, and to create a server to host all of the IETF based CDDL modules?

A think that I dislike about the ENTITY stuff in XML is that the URLs are way
too specific.   Do you want avoid that?  Will it be some URN space?

    > 3.  For any number of reasons we need to be able to state that some symbols
    > are going to be imported from a different module.  There are some issues
    > around doing a couple of other things:
    > *  If all symbols are imported then you either need to have a module based
    > naming system or you need to ensure that there are no collisions.
    > *  If only specific symbols are imported, then they could either be a) made
    > to be unique by renaming or b) made to be unique in the current module
    > simply by how the module is written

Can you give an example of (b)?
I think that Python mostly got this process right.

    > 4.  ASN.1 has a method to say that only specific symbols can be exported
    > from a module.  I have never used this capability and I am not clear that it
    > would be useful to have here.  Should we support it anyway?

No. It just leads to stupid work arounds.
_ for things that should not be exported, but not enforced.

    > 5.  How should the system be setup to be able to recognize this capability.
    > The suggestion in the freezer document currently is to use a pragma system.
    > Introducing a pragma system can easily be seen as a step to allow for
    > compilers of CDDL to be written.   The A2C compiler that I wrote used --#
    > and #-- as the start and stop delimiters for pragmas as "--" is the
    > start/stop comment character.  (ASN.1 is not line based so there is no
    > comment till a return.)  A similar approach can easily be used here.

I prefer that the statement not be a pre-processor-like hack.

    > 6.  If we use a pragma naming system, do we want to setup in advance for it
    > to have namespaces so that a single module could be used with different
    > compilers.  I ended up using a different string  than the OSS compiler did
    > ("--<" ">--") to be able to do this but having a namespace could also
    > support this.

I don't understand.

    > 7.  What set of pragmas are we looking at to start with.  XML Schema has
    > some attributes that can be used for controlling the compiler.  One of this
    > is a location hint attribute which can be used for giving alternate
    > locations to use for finding a module (such as a location on my machine).
    > There might be some other pragmas that might be useful to specify as well.
    > It might be easier to specify co-occurrence constraints using pragmas rather
    > than trying to put it directly into the language.

This is useful at the top-level file.
Particularly for a group of people who are working together.
For "location on my machine", I think that I'd rather be providing a command
flag, but I don't object to having ../.. paths or
https://my.little.server.example/ in a file.

--
Michael Richardson <mcr+IETF@sandelman.ca>, Sandelman Software Works
 -= IPv6 IoT consulting =-