|
From: | Paul Eggert |
Subject: | Re: scratch/accurate-warning-pos: Solid progress: the branch now bootstraps. |
Date: | Sat, 1 Dec 2018 13:26:48 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
Yuri Khan wrote:
A macro that has a 'position-aware property on it can be called directly on the position-annotated AST and expected to use ‘eq-with-position-information’; while a legacy macro will be called on a de-annotated AST, may use plain ‘eq’, and will return a similarly position-oblivious AST.
Thanks, this is a good suggestion, perhaps the best idea I've heard so far in this thread. Here are a few more suggestions on top of it.
1. We could have (equal A B) ignore position information in A and B; this would make it more convenient for macros to use existing code based on 'equal', and it'd mean we wouldn't need a new predicate eq-with-position-information. In one form of this idea, when A and B are symbols then (equal A B) acts like (string-equal (symbol-name A) (symbol-name B)), thus ignoring the distinction between interned and uninterned symbols. In another form of this idea, (equal A B) merely ignores position information.
2. Instead of having a bulky notation for new, position-aware macros, we could use a syntax that's shorter or simpler than what we have now, to make new-style macros more appealing. For example, we could use "defmac" to define new-style macros, and keep "defmacro" for old ones (we can say that the trailing "ro" stands for "region oblivious" :-).
3. If (2) is too drastic for you, we could have something like "(require 'position-macros)" (or some other syntax) that tells the byte-compiler that all macros in this file are smart about positions; this would be more convenient than annotating each macro individually. Also, we could warn people that this is a transition approach, and that eventually the idea will be that position-macros will be the default and that if you want an old-style macro you need to explicitly annotate it as old-style.
[Prev in Thread] | Current Thread | [Next in Thread] |