From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "J. Ian Johnson" Newsgroups: gmane.emacs.bugs Subject: bug#3824: This problem persists Date: Tue, 15 Apr 2014 11:39:52 -0400 (EDT) Message-ID: <11168152.67691397576392365.JavaMail.root@zimbra> References: <20090711163545.1FF939828B@pluto.mumble.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1397586995 21870 80.91.229.3 (15 Apr 2014 18:36:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Apr 2014 18:36:35 +0000 (UTC) To: 3824@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 15 20:36:28 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wa8DZ-00011A-J1 for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Apr 2014 20:36:25 +0200 Original-Received: from localhost ([::1]:51302 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wa8DY-00014h-T8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Apr 2014 14:36:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wa8DN-0000w9-M7 for bug-gnu-emacs@gnu.org; Tue, 15 Apr 2014 14:36:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wa8DD-0008B6-2E for bug-gnu-emacs@gnu.org; Tue, 15 Apr 2014 14:36:13 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40978) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wa8DC-0008B2-UO for bug-gnu-emacs@gnu.org; Tue, 15 Apr 2014 14:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Wa8DC-0008AB-JX for bug-gnu-emacs@gnu.org; Tue, 15 Apr 2014 14:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "J. Ian Johnson" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Apr 2014 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3824 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 3824-submit@debbugs.gnu.org id=B3824.139758694631335 (code B ref 3824); Tue, 15 Apr 2014 18:36:02 +0000 Original-Received: (at 3824) by debbugs.gnu.org; 15 Apr 2014 18:35:46 +0000 Original-Received: from localhost ([127.0.0.1]:49132 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wa8Cv-00089H-6W for submit@debbugs.gnu.org; Tue, 15 Apr 2014 14:35:46 -0400 Original-Received: from amber.ccs.neu.edu ([129.10.116.51]:55327) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wa5Sq-0002hS-IA for 3824@debbugs.gnu.org; Tue, 15 Apr 2014 11:40:01 -0400 Original-Received: from zimbra.ccs.neu.edu ([129.10.116.59]) by amber.ccs.neu.edu with esmtp (Exim 4.69) (envelope-from ) id 1Wa5Sq-0005Au-0A for 3824@debbugs.gnu.org; Tue, 15 Apr 2014 11:40:00 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.ccs.neu.edu (Postfix) with ESMTP id EB77CF5C012 for <3824@debbugs.gnu.org>; Tue, 15 Apr 2014 11:39:59 -0400 (EDT) X-Virus-Scanned: amavisd-new at zimbra.ccs.neu.edu Original-Received: from zimbra.ccs.neu.edu ([127.0.0.1]) by localhost (zimbra.ccs.neu.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qdRfPu2RnPUw for <3824@debbugs.gnu.org>; Tue, 15 Apr 2014 11:39:52 -0400 (EDT) Original-Received: from zimbra.ccs.neu.edu (zimbra.ccs.neu.edu [129.10.116.59]) by zimbra.ccs.neu.edu (Postfix) with ESMTP id 752C0F5C010 for <3824@debbugs.gnu.org>; Tue, 15 Apr 2014 11:39:52 -0400 (EDT) In-Reply-To: <14931252.67511397575947384.JavaMail.root@zimbra> X-Originating-IP: [129.10.110.48] X-Mailer: Zimbra 5.0.22_GA_3210.UBUNTU6 (ZimbraWebClient - FF3.0 (Linux)/5.0.22_GA_3210.UBUNTU6) X-Mailman-Approved-At: Tue, 15 Apr 2014 14:35:40 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88040 Archived-At: I use #; comments extensively in my Racket code, and have been bitten by em= acs's weird handling of it. Taylor pointed me to this bug to follow up. The following is a snippet from one of my projects, with a single #; commen= t in it. When you copy and paste it into emacs, it will likely match the parens corr= ectly. If you save it into a file and reopen it, it will not. If you M-> C-= M-b, then it will mark them matching. My delay in reporting this is because the problem with #; really only manif= ests in large (more than a screen) sexps. Once I navigate it /enough/, then= things match and I can keep working. I don't have a good qualification for= "enough," i.e., what navigation is necessary for the parens to be marked m= atching; I only know that this should be seen as incorrect/buggy behavior. I do hope that this can be fixed for later releases of emacs23/24. Thanks, -Ian (define (a/equal? d=E2=82=80 d=E2=82=81 store-spaces =CE=BC) (define/match (egal-equal? a=E2=82=80 a=E2=82=81) [((Address-Egal space a) (Address-Egal space a)) (match (hash-ref =CE=BC a=E2=82=80 '=CF=89) [1 #t] ['=CF=89 'b.=E2=8A=A4] [0 (error 'a/match "Live address with count 0: ~a (Counts ~a) (Store= ~a)" a=E2=82=80 =CE=BC store-spaces)])] [(_ _) #f]) (define (ffun-equal? f=E2=82=80 f=E2=82=81) (if abs? (b=E2=88=A7 (ffun-=E2=8A=91? f=E2=82=80 f=E2=82=81) (ffun-=E2=8A=91? f=E2=82=81 f=E2=82=80)) (concrete-ffun-equal? f=E2=82=80 f=E2=82=81))) ;; Slow path: linearly look for a key "equal" to k with "equal" values. (define (slow-equal k v f) (for/b=E2=88=A8 ([(k=E2=82=81 v=E2=82=81) (in-dict f)]) (b=E2=88=A7 (a/equal? k k=E2=82=81) (a/equal? v v=E2=82=81)))) (define (ffun-=E2=8A=91? dom f=E2=82=80 f=E2=82=81) (for/b=E2=88=A7 ([(k v) (in-dict f=E2=82=80)]) (match (dict-ref f=E2=82=81 k -unmapped) [(=3D=3D -unmapped eq?) (slow-equal k v f=E2=82=81)] [v=E2=82=81 ;; fast path: check the structurally equal key (b=E2=88=A8 (a/equal? v=E2=82=80 v=E2=82=81) (slow-equal k v f=E2=82=81))]))) (define (concrete-ffun-equal? m=E2=82=80 m=E2=82=81) (and (=3D (dict-count m=E2=82=80) (dict-count m=E2=82=81)) (for/b=E2=88=A7 ([(k=E2=82=80 v=E2=82=80) (in-dict m=E2=82=80)]) (match (dict-ref m=E2=82=81 k=E2=82=80 -unmapped) ;; Concrete domains w/o structural equality are actually= abstract. ;; Note this is different from the concrete semantics. [(=3D=3D -unmapped eq?) #f] ;; Note we don't use b=E2=88=A8 with the slow path [v=E2=82=81 (a/equal? v=E2=82=80 v=E2=82=81)])))) (define (discrete-ffun-equal? m=E2=82=80 m=E2=82=81) (and (=3D (dict-count m=E2=82=80) (dict-count m=E2=82=81)) (for/b=E2=88=A7 ([(k=E2=82=80 v=E2=82=80) (in-dict m=E2=82=80)]) (match (dict-ref m=E2=82=81 k=E2=82=80 -unmapped) [(=3D=3D -unmapped eq?) #f] [v=E2=82=81 (b=E2=88=A7 ;; Discrete maps get structural equality on keys, b= ut can only be=20 ;; truly equal if the key has cardinality 1. (if (=E2=88=A3=CE=B3=E2=88=A3>1 k=E2=82=80 =CE=BC) = 'b.=E2=8A=A4 #t) (a/equal? v=E2=82=80 v=E2=82=81))])))) (define (equal-step d=E2=82=80 d=E2=82=81) (match* (d=E2=82=80 d=E2=82=81) [((variant v ds=E2=82=80) (variant v ds=E2=82=81)) (for/b=E2=88=A7 ([d=E2=82=80 (in-vector ds=E2=82=80)] [d=E2=82=81 (in-vector ds=E2=82=81)]) (a/equal? d=E2=82=80 d=E2=82=81))] ;; Addresses are the same if they have cardinality 1. Distinct addres= ses don't overlap. [((? Address-Egal?) (? Address-Egal?)) (egal-equal? d=E2=82=80 d=E2=82=81)] [((? Address-Structural? a=E2=82=80) (? Address-Structural? a=E2=82= =81)) (if (eq? (egal-equal? a=E2=82=80 a=E2=82=81) #t) #t ;; INVARIANT: not possible to be -unmapped since there must be ;; at least one value mapped in a store's address. (for*/b=CE=B4 ([d=E2=82=80 (in-set (store-ref store-spaces a=E2= =82=80))] [d=E2=82=81 (in-set (store-ref store-spaces a=E2=82=81= ))]) (a/equal? d=E2=82=80 d=E2=82=81)))] [((? dict? m=E2=82=80) (? dict? m=E2=82=81)) (concrete-ffun-equal? m= =E2=82=80 m=E2=82=81)] ;; If at least one map has qualification, we can check the other with= the expectation of the same. ;; We log the incident for future debugging, since it seems like we s= houldn't get this far. [((? dict? m=E2=82=80) (abstract-ffun m=E2=82=81)) (log-info (format "Qualified/unqualified dictionary equality check ~= a ~a" d=E2=82=80 d=E2=82=81)) (ffun-equal? m=E2=82=80 m=E2=82=81)] [((abstract-ffun m=E2=82=80) (? dict? m=E2=82=81)) (log-info (format "Qualified/unqualified dictionary equality check ~= a ~a" d=E2=82=80 d=E2=82=81)) (ffun-equal? m=E2=82=80 m=E2=82=81)] [((abstract-ffun m=E2=82=80) (abstract-ffun m=E2=82=81)) (ffun-equal?= m=E2=82=80 m=E2=82=81)] ;; Discrete cases [((discrete-ffun m=E2=82=80) (? dict? m=E2=82=81)) (log-info (format "Qualified/unqualified (discrete) dictionary equal= ity check ~a ~a" d=E2=82=80 d=E2=82=81)) (discrete-ffun-equal? m=E2=82=80 m=E2=82=81)] [((? dict? m=E2=82=80) (discrete-ffun m=E2=82=81)) (log-info (format "Qualified/unqualified (discrete) dictionary equal= ity check ~a ~a" d=E2=82=80 d=E2=82=81)) (discrete-ffun-equal? m=E2=82=80 m=E2=82=81)] [((discrete-ffun m=E2=82=80) (discrete-ffun m=E2=82=81)) (discrete-ffun-equal? m=E2=82=80 m=E2=82=81)] ;; OPT-OP: This has no information on discrete abstractions, thus n= =C2=B2logn instead of sometimes nlogn [((? set? s=E2=82=80) (? set? s=E2=82=81)) (define (=E2=8A=86? s=E2=82=80 s=E2=82=81) (for/b=E2=88=A7 ([v (in-set s=E2=82=80)]) (for/b=E2=88=A8 ([v* (in-set s=E2=82=81)]) (a/equal? v v*)))) (b=E2=88=A7 (=E2=8A=86? s=E2=82=80 s=E2=82=81) (=E2=8A=86? s=E2=82= =81 s=E2=82=80))] [(atom atom) #t] [((external ex v=E2=82=80) (external ex v=E2=82=81)) (match-define (External-Space _ card precision special-equality) ex) (if special-equality (special-equality v=E2=82=80 v=E2=82=81 =CE=BC #;a/equal?)=20 (match precision ['concrete (equal? v=E2=82=80 v=E2=82=81)] ['discrete-abstraction (b=E2=88=A7 (equal? v=E2=82=80 v=E2=82= =81) (implies (eq? (card v=E2=82=80 =CE=BC)) 'b.=E2=8A=A4))] ['abstract (error 'a/match "Cannot have non-discrete abstracti= on of external values without a custom equality relation ~a" d=E2=82=80)]))= ] [(_ _) #f])) ;; Circular addresses are possible ;; OPT-OP?: Racket impl of equal? uses union-find instead of Map[_,Set[_]= ]. ;; Is that applicable here? (define seen (make-hasheq)) (define (a/equal? d=E2=82=80 d=E2=82=81) (define checked-against (hash-ref! seen d=E2=82=80 mutable-seteq)) ;; already checked =E2=87=92 assume equal ;; XXX: should this be #t or 'b.=E2=8A=A4? (or (set-member? checked-against d=E2=82=81) (begin (set-add! checked-against d=E2=82=81) (equal-step d=E2=82=80 d=E2=82=81)))) (a/equal? d=E2=82=80 d=E2=82=81))