all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: MON KEY <monkey@sandpframing.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: cyd@stupidchicken.com, schwab@linux-m68k.org, 6878@debbugs.gnu.org
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	[thread overview]
Message-ID: <AANLkTimrZosDDyQjva5WGfNpCUuTb4WtyAZ5FOgFV=Nj@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimhQDy0SRC-Evp_XN1a3waCS5c+4kk+hx2z0gez@mail.gmail.com>

On Fri, Aug 20, 2010 at 3:49 PM, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Fri, Aug 20, 2010 at 20:01, MON KEY <monkey@sandpframing.com> 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-vectors
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 that
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)
;=> #&29"\377\377\377\x1f"

to:
(make-bool-vector 29 t)

;=> #&29[#b11111111 #b11111111 #b11111111 #b00011111]

; e.g. (/ 29 8) => 3
;      (% 29 8) => 5

(make-bool-vector 0 t)
;=> #&0[]

(vconcat [#b11111111 #b11111111 #b11111111 #b00011111])
;=> [255 255 255 31]

(apply 'unibyte-string (append [#b11111111 #b11111111 #b11111111
#b00011111] nil))
;=> "\377\377\377\x1f"

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


>     Juanma
>

--
/s_P\





  reply	other threads:[~2010-08-20 23:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18  4:19 bug#6878: bool-vectors of length 0 signal error when aref/aset the 0th element MON KEY
2010-08-18  7:36 ` Stefan Monnier
2010-08-19  1:51   ` MON KEY
2010-08-19  8:42     ` Andreas Schwab
2010-08-19 14:13       ` MON KEY
2010-08-19 15:51         ` Stefan Monnier
2010-08-19 17:06           ` MON KEY
2010-08-19 14:47       ` Stefan Monnier
2010-08-19 15:04         ` Andreas Schwab
2010-08-19 16:18     ` Chong Yidong
2010-08-19 17:09       ` MON KEY
2010-08-19 18:40         ` Juanma Barranquero
2010-08-19 23:24         ` Chong Yidong
2010-08-20  2:01           ` MON KEY
2010-08-20  2:23             ` Juanma Barranquero
2010-08-20 18:01               ` MON KEY
2010-08-20 19:49                 ` Juanma Barranquero
2010-08-20 23:06                   ` MON KEY [this message]
2010-08-20 13:02             ` Stefan Monnier
2010-08-20 18:44               ` MON KEY
2010-08-21 12:40                 ` Kevin Rodgers
2010-08-21 15:53                   ` Andreas Schwab
2010-08-21 17:02   ` MON KEY
2010-08-18  8:36 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTimrZosDDyQjva5WGfNpCUuTb4WtyAZ5FOgFV=Nj@mail.gmail.com' \
    --to=monkey@sandpframing.com \
    --cc=6878@debbugs.gnu.org \
    --cc=cyd@stupidchicken.com \
    --cc=lekktu@gmail.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.