In my view, the main objections to identifier properties are purely technical,
N=3 criterion have little to do here.
1) Identifier properties complicate the semantic of an identifier.
Traditionally, the same (wrt free-identifier?) identifiers can be
exported from different libraries, and being imported multiple-times in
the same libraries. Many SRFI implementations import the binding of
'=>', '...' from (rnrs base) or (scheme base), and re-export these
bindings. These libraries can be togetherly imported with (rnrs base) or
(scheme base), implementation will not complain about conflicts because
they are the same. free-identifier=? thus formed an intuitive criterion
on the sameness of identifiers imported from different libraries.
Introducing dentifier properties would break the intuition, if the same
identifier in same library was imported multiple-times, and each import
attempted to attach different properties on it. These identifiers will
be different (see the last Note of
<
https://r7rs.org/large/fascicles/macro/1/syntax-transformation.html#identifier-properties>).
1) Current identifier properties proposal allows user to define
properties on "foreign" identifiers. At first glance, this seems to be
the original intent of properties -- SRFI-262 utilizes it to attach
pattern expander for identifiers in different libraries, thus avoids the
"ugly" ~pattern convention used in SRFI-257.
However, current proposal also allows user to define properties on
"foreign" identifier with "foreign" keys. For example
(import (rnrs) (srfi :213))
;; both cons and car are not under the fully control of current library
(define-property cons car 20)
This is somewhat similar to the issue that "orphan rules" [orphan] of
typeclass/trait in Haskell/Rust aim to address. Macrological fascicles
claim that "If two properties with the same key are imported on the same
identifier, and the values of the properties are not the same in the
sense of eqv?, it is an import error". The solution remains open to
debate (for example, introduce rules like "orphan rules")
3) <
https://codeberg.org/scheme/r7rs/issues/243> showed a critical issue
that identifier properties lacks of access control.
4) Currently identifier properties are expand-time (or phase 1) value.
In Chez Scheme and SRFI-213 use, though Macrological Fascicle introduced
a dedicated procedure 'identifier-property', but it still assume that it
was invoked in the dynamic extent of a macro expansion. Using identifier
properties as docstring or other similar purposes, its semantics under
run-time (phase 0), and the its interoperability between library system
must be considered.
If a certain Scheme implementation with a significant community dare to
take the challenge described above, it would clearly boost out
confidence in the standardization of identifier properties. Currently,
only Chez Scheme and Unsyntax support such feature, I had hoped that
Guile would implement identifier properties and address the outstanding
issues mentioned above, but as things stand, Andy Wingo seems to be busy
with hoot (Guile’s WASM variant, it has its own expander which is
different from the original one of Guile).
[orphan]:
https://doc.rust-lang.org/reference/items/implementations.html#r-items.impl.trait.orphan-rule
--
Retrieve my PGP public key:
执行下列命令以获取我的 PGP 公有密钥:
gpg --recv-keys B3EBC086AB0EBC0F45E0B4D433DB374BCEE4D9DC
Zihao / 閱卜錄