From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.bugs Subject: bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element Date: Fri, 20 Aug 2010 19:06:25 -0400 Message-ID: References: <87r5hutw2q.fsf@stupidchicken.com> <87fwyauqwy.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1282345816 22059 80.91.229.12 (20 Aug 2010 23:10:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Aug 2010 23:10:16 +0000 (UTC) Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 21 01:10:14 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OmaiD-0002bK-NP for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Aug 2010 01:10:11 +0200 Original-Received: from localhost ([127.0.0.1]:38129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Omai1-0001w4-J2 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Aug 2010 19:09:13 -0400 Original-Received: from [140.186.70.92] (port=59751 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Omahu-0001vj-Id for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 19:09:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Omahs-0006IZ-Sw for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 19:09:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49997) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Omahs-0006IT-QV for bug-gnu-emacs@gnu.org; Fri, 20 Aug 2010 19:09:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Omaew-0007ZI-3k; Fri, 20 Aug 2010 19:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: MON KEY Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Aug 2010 23:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6878 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6878-submit@debbugs.gnu.org id=B6878.128234551929082 (code B ref 6878); Fri, 20 Aug 2010 23:06:02 +0000 Original-Received: (at 6878) by debbugs.gnu.org; 20 Aug 2010 23:05:19 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmaeE-0007Z1-EI for submit@debbugs.gnu.org; Fri, 20 Aug 2010 19:05:18 -0400 Original-Received: from mail-ww0-f42.google.com ([74.125.82.42]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmaeB-0007Yv-Gr for 6878@debbugs.gnu.org; Fri, 20 Aug 2010 19:05:16 -0400 Original-Received: by wwf26 with SMTP id 26so1206607wwf.3 for <6878@debbugs.gnu.org>; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) Original-Received: by 10.216.21.204 with SMTP id r54mr1836142wer.95.1282345585844; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) Original-Received: by 10.216.65.140 with HTTP; Fri, 20 Aug 2010 16:06:25 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 80aiKjT1OjjbeICdkLoc4v41fNU X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 20 Aug 2010 19:06:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39679 Archived-At: On Fri, Aug 20, 2010 at 3:49 PM, Juanma Barranquero wrot= e: > On Fri, Aug 20, 2010 at 20:01, MON KEY wrote: >> My question was _specifcally_ w/re to bool-vectors >> one _can not_ take the substring of a bool-vector. > > You're right, I misread. > NP. So, safe to assume you haven't come up w/ a good reason to take the 0th elt of a bool-vector? > But that's an argument, if at all, to make bool-vectors act like other > vectors (which is to say, to make array/vector primitives to act on > them like they do other vectors), not to make them more different. > No. You are wrong about this. As they are currently implemented it doesn't make sense to operate directly on the bool-vector string content because the "string" is only an abstraction of the data... There isn't actually a string there to operate upon - it is miasma. More to the point you can't represent a byte as a string, and w/re bool-vec= tors the print representation of the string returned is multibyte but represents= a unibyte char! Figuring out how to reliably DTRT w/re the different ways tha= t Emacs currently conflates multibyte strings with unibyte strings would only further complicate the existing kluge that is `make-bool-vector'. What would be _much_ better would be to change the read/print syntax for `make-bool-vector' from: (make-bool-vector 29 t) ;=3D> #&29"\377\377\377=1F" to: (make-bool-vector 29 t) ;=3D> #&29[#b11111111 #b11111111 #b11111111 #b00011111] ; e.g. (/ 29 8) =3D> 3 ; (% 29 8) =3D> 5 (make-bool-vector 0 t) ;=3D> #&0[] (vconcat [#b11111111 #b11111111 #b11111111 #b00011111]) ;=3D> [255 255 255 31] (apply 'unibyte-string (append [#b11111111 #b11111111 #b11111111 #b00011111] nil)) ;=3D> "\377\377\377=1F" Something like that is quite a bit more readable to my eyes (pun intended). Though I doubt doing anything like this is very high up on anyones list given the occurences of `make-boole-vector' in ./lisp > =C2=A0 =C2=A0 Juanma > -- /s_P\