Ar an dara lá déag de mí Lúnasa, scríobh Stephen J. Turnbull:
Aidan Kehoe writes:
> GNU has had this for a while. Their implementation isn’t particularly
> object-oriented, and I wrote the bulk of the below before we moved to
> GPLv3, so it’s very different code. If anyone’s interested in writing
> tests, I can commit this, but I won’t get to writing tests myself for
> a while, and I’m not in a rush to commit the change without them.
Haven't we had a feature of numbering self-referential objects, and
printing references to those objects in subobjects as numerical reference
since the turn of the millennium or so?
We have, yes, but that syntax throws an error on read. Try it:
(let ((vector [1 2 3 4 5]))
(aset vector 4 vector)
vector)
=> [1 2 3 4 #0]
[1 2 3 4 #0]
=> Invalid read syntax: #
(setq print-circle t)
=> t
(let ((vector [1 2 3 4 5]))
(aset vector 4 vector)
vector)
=> #1=[1 2 3 4 #1#]
#1=[1 2 3 4 #1#]
=> #1=[1 2 3 4 #1#]
(aref #1=[1 2 3 4 #1#] 4)
=> #1=[1 2 3 4 #1#]
Not to mention that <circular list> is not readable:
(setq print-circle nil)
=> nil
(let ((list (list 1 2 3 4)))
(nconc list list))
=> (1 2 3 4 1 2 3 ... <circular list>)
(1 2 3 4 1 2 3 ... <circular list>)
=> Invalid read syntax: .
(setq print-circle t)
=> t
(let ((list (list 1 2 3 4)))
(nconc list list))
=> #1=(1 2 3 4 . #1#)
But reading this in *scratch* fails, while it succeeds in other contexts;
lisp-interaction-mode doesn’t yet know enough about this.
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches