From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <0675C09C-3138-490A-8FCD-99ACD083CA23@mac.com> From: Pietro Gagliardi To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-Reply-To: <14ec7b180805041924uad42871m7f30be033f7cbfd4@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Mon, 5 May 2008 06:16:44 -0400 References: <20080504074224.C796685B2@okapi.maths.tcd.ie> <775b8d190805040518w947ffc6g12fbe4da693de8a1@mail.gmail.com> <2CA5005D-3B72-44C0-B1A5-89F72C2C6E7F@mac.com> <5F6CBD28-FC04-4D68-AA60-B36568DE7005@mac.com> <14ec7b180805041924uad42871m7f30be033f7cbfd4@mail.gmail.com> Subject: Re: [9fans] A new language for Plan 9 Topicbox-Message-UUID: 9f08ff90-ead3-11e9-9d60-3106f5b1d025 On May 4, 2008, at 10:24 PM, andrey mirtchovski wrote: >> Set for the next release: bit arrays. > > "I'd use plan 9 before i'd use bitfields" -- pjw > I'm aware of that quote. The design of bit arrays will be totally different from the design of bitfields. They are true arrays that can be used in an implementation-independent manner. Given b: 32 bits b[0] := 4 the compiler will determine whether b[0] is at the far left or far right of the binary version of that value. This means you can have code, theoretically, like function getlong: 32 bits b: 32 bits b[31..24] := getchar - '0' b[23..16] := getchar - '0' b[15..8] := getchar - '0' b[7..0] := getchar - '0' return b and then use getlong as follows: x: 32 bits = getlong if x = 400 then { ... } This is a severe blow to bit fields. No, I'm not doing a school assignment. This is more of a hobby project.