Re: [Cbor] CDDL 2.0 import and paths
Carsten Bormann <cabo@tzi.org> Mon, 06 February 2023 17:22 UTC
Return-Path: <cabo@tzi.org>
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 611A1C14F6EB for <cbor@ietfa.amsl.com>; Mon, 6 Feb 2023 09:22:33 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.899
X-Spam-Level:
X-Spam-Status: No, score=-6.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id izJGI4Z6ssA8 for <cbor@ietfa.amsl.com>; Mon, 6 Feb 2023 09:22:27 -0800 (PST)
Received: from smtp.zfn.uni-bremen.de (gabriel-smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B6828C14CEE3 for <cbor@ietf.org>; Mon, 6 Feb 2023 09:22:25 -0800 (PST)
Received: from [192.168.217.124] (p548dc9a4.dip0.t-ipconnect.de [84.141.201.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4P9Y3f6rp0zDCcF; Mon, 6 Feb 2023 18:22:22 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <PH0PR02MB72561C8C79F5B0A9E2ED4540F2DA9@PH0PR02MB7256.namprd02.prod.outlook.com>
Date: Mon, 06 Feb 2023 18:22:22 +0100
Cc: Michael Richardson <mcr+ietf@sandelman.ca>, "cbor@ietf.org" <cbor@ietf.org>
X-Mao-Original-Outgoing-Id: 697396942.453667-1d0acc35907101b1b3bf1022f6d37b33
Content-Transfer-Encoding: quoted-printable
Message-Id: <7CABC53E-E18F-44C5-B6C1-B4A13E8FB55F@tzi.org>
References: <Y9FYSKde6bXgzep3@hephaistos.amsuess.com> <BAFC97D5-3B5A-4ED5-ADEC-93CB53CC2128@tzi.org> <2304074.1675693261@dyas> <0F5E27CB-44D6-4112-A7BA-8372F36EF3B3@tzi.org> <2312048.1675698835@dyas> <PH0PR02MB72561C8C79F5B0A9E2ED4540F2DA9@PH0PR02MB7256.namprd02.prod.outlook.com>
To: Jeremy O'Donoghue <jodonogh@qti.qualcomm.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/0G7o9e_DAM2BrsAQtQZvOKYlzPI>
Subject: Re: [Cbor] CDDL 2.0 import and paths
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
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: Mon, 06 Feb 2023 17:22:33 -0000
Hi Jeremy, > On 2023-02-06, at 17:03, Jeremy O'Donoghue <jodonogh@qti.qualcomm.com> wrote: > > Recursive includes are enough of a problem that generations of C programmers have learned the approach below. > > #ifndef _name_of_file > #define _name_of_file > > /* definitions follow… */ > > #endif Thanks for this interesting thought! I see this C/C++ language practice less as a protection against recursion than a protection against dual incorporation of the include file text. C/C++ are now slowly getting module systems in place, which are certainly interesting to look at. C++ has had namespaces for a long time, which is again interesting to look at. But let’s look at basic C. In C, include file text is not idempotent. It is also highly order-dependent, so sometimes you need to include early. CDDL has idempotent rule definition, as well as order independence, except for identifying the start rule and for /= and //= (and I must admit that my implementation doesn’t pay a lot of attention to the latter, and we probably should be more explicit about the use cases where /= and //= are appropriate). The import semantics further reduce the damage from importing something twice (which is innocuous but could greatly increase file sizes) by only filling in names that have been undefined before; you deliberately don’t get that with the include semantics. Include semantics is what you probably want for controlled use within a project; import semantics is more useful for referencing another project from your project. > IOW, you either need to define a module system with semantics and namespaces, or re-implement the C preprocessor. I think the question whether the module system can be implemented in a preprocessor is quite open. “The C preprocessor” obviously is not something we want to copy. But I’d like to zoom in a bit more about “with semantics and namespaces” — what exactly do we need here? Grüße, Carsten
- [Cbor] CDDL 2.0 import and paths Christian Amsüss
- Re: [Cbor] CDDL 2.0 import and paths Michael Richardson
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Michael Richardson
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Michael Richardson
- Re: [Cbor] CDDL 2.0 import and paths Jeremy O'Donoghue
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Michael Richardson
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann
- Re: [Cbor] CDDL 2.0 import and paths Carsten Bormann