Re: [Cbor] CDDL Module Design

Jim Schaad <ietf@augustcellars.com> Wed, 01 July 2020 14:49 UTC

Return-Path: <ietf@augustcellars.com>
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 785013A0B1B for <cbor@ietfa.amsl.com>; Wed, 1 Jul 2020 07:49:42 -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 08A5Plvu8hFl for <cbor@ietfa.amsl.com>; Wed, 1 Jul 2020 07:49:40 -0700 (PDT)
Received: from mail2.augustcellars.com (augustcellars.com [50.45.239.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id BFE813A0C1A for <cbor@ietf.org>; Wed, 1 Jul 2020 07:49:39 -0700 (PDT)
Received: from Jude (73.180.8.170) by mail2.augustcellars.com (192.168.0.56) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 1 Jul 2020 07:49:34 -0700
From: Jim Schaad <ietf@augustcellars.com>
To: 'Carsten Bormann' <cabo@tzi.org>
CC: cbor@ietf.org
References: <03c701d64f41$e1763fa0$a462bee0$@augustcellars.com> <58F93C93-9EC6-465E-B421-12AA69F17CAF@tzi.org>
In-Reply-To: <58F93C93-9EC6-465E-B421-12AA69F17CAF@tzi.org>
Date: Wed, 01 Jul 2020 07:49:32 -0700
Message-ID: <040901d64fb6$d6669ea0$8333dbe0$@augustcellars.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
thread-index: AQJ5T9b3i55/+CwwqSdD3kqEjEw/wALtmhslp5VekwA=
X-Originating-IP: [73.180.8.170]
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/wWMiM_Kng460bTL3S5i5aIenjPo>
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 14:49:43 -0000


> -----Original Message-----
> From: CBOR <cbor-bounces@ietf.org> On Behalf Of Carsten Bormann
> Sent: Tuesday, June 30, 2020 10:33 PM
> To: Jim Schaad <ietf@augustcellars.com>
> Cc: cbor@ietf.org
> Subject: Re: [Cbor] CDDL Module Design
> 
> Hi Jim,
> 
> we have had a long discussion about namespacing in the SDF work, and came
> up with:
> https://www.ietf.org/id/draft-onedm-t2trg-sdf-00.html#name-names-and-
> namespaces
> 
> Now SDF is not CDDL, but I think there are lessons to be learned.
> 
> For a while, we were thinking about using URIs to find referenced parts of a
> specification.  This is comparable to the way Java does its module naming; you
> essentially need to put the code into the place that is implied by its name.
> 
> Instead, we have decided to go for a push model, which is essentially the way
> C++, C#, and other languages maintain their namespaces.  A module declares
> into which namespaces its names go.  There is no automatic finding of
> modules, but there also is no pain about who can contribute to a namespace.

There is also nothing to prevent the reuse of the same name in the in the same namespace by multiple contributors.  

> 
> > On 2020-07-01, at 02:52, Jim Schaad <ietf@augustcellars.com> wrote:
> >
> > Here is a topic that we can potentially discuss tomorrow if there is
> > extra time on the agenda.
> >
> > When looking at a CDDL module design, there are a set of questions
> > that I think need to be addressed:
> >
> > 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.   I think therefore it
> > would be nice to have a naming system that recognizes version numbers,
> 
> (I think you are talking about revision numbers.
> Version numbers are often not what one wants; instead one should use feature
> identifiers.)

I am happy with the term revision number here.  Without having a better description of what you think is the difference, I am not sure that I see a significant one.  I do have a potential problem with the use of feature identifiers as we would not be tagging it with two different meanings that need to be distinguished.  At one point were we going to use this for differences in the CDDL language and now you are also using it for differences in CDDL sources.

> 
> > 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.
> >
> > 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?
> 
> That was what we decided we didn’t want to do in SDF.
> 
> > 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.
> 
> Note how C++ doesn’t really do that.
> (Well, if you declare a name and don’t define it, it needs to be external.)

And yet C++ does end up with header files which need to be included (or duplicated) in order to have the same consistent view of what any class does.   It also will end up with problems if two different source files declare (and define) a single name in the same namespace.

> 
> > 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.
> 
> I would like to separate the external naming system from the internal one we
> use in a spec.
> 
> Note how a spec already today uses symbols from the prelude and from the
> spec itself.  (This of course works “automagically” only because the prelude is
> fixed and you simply cannot use the symbols that the prelude squats on.)
> 
> > *  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
> 
> Yes.
> 
> > 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?
> 
> I think there might be a place for an advisory-level setting (as in “these names
> will normally be imported if this module is imported whole-sale”).  Experience
> shows that there are good reasons to violate any “encapsulation” attempt, so I
> would not disallow importing further names from a module explicitly.
> 
> > 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.
> 
> This is the approach I would prefer.
> 
> However, there also is semantics imparted by using a symbol.
> In actual CDDL usage, the symbols used become annotations in the post-
> validation instance.  These annotations will need to be namespaced, and
> possibly be linked to RDF names (which are URIs not intended for
> dereferencing).
> 
> > 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.
> 
> Indeed, we could play around with more than one module/namespace
> management system, as long as there is a way to generate a basic CDDL
> specification from each.
> 
> > 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).
> 
> Tempting, but this leads us back into pull land.
> 
> > 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.
> 
> I think that all constraints need to be part of the language.
> 
> Grüße, Carsten
> 
> 
> _______________________________________________
> CBOR mailing list
> CBOR@ietf.org
> https://www.ietf.org/mailman/listinfo/cbor