Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Make own type (object) type in javascript. Date: Sun, 07 Jun 2015 10:19:35 +0100 Organization: A noiseless patient Spider Lines: 36 Message-ID: <87sia3kh94.fsf@bsb.me.uk> References: <66362d49-af1e-400b-b026-0e6d9b679f98@googlegroups.com> <87iob0l79e.fsf@bsb.me.uk> <877frgl5lz.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="017616aa25f81ec581c44d76d61ba2f3"; logging-data="15075"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Vo648ApX36rGs8iEN9sDU7gZ2Mp/txgc=" Cancel-Lock: sha1:r6zijIAznGQnJVvLlQNWgtQPpqM= sha1:ziiDwD1aDxVEn+WNV+/lnB+WNuA= X-BSB-Auth: 1.e4a8660f95625946aeed.20150607101935BST.87sia3kh94.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:28020 jonas.thornvall@gmail.com writes: > Den söndag 7 juni 2015 kl. 02:33:32 UTC+2 skrev Ben Bacarisse: >> ram@zedat.fu-berlin.de (Stefan Ram) writes: >> >> > Ben Bacarisse writes: >> >>jonas.thornvall@gmail.com writes: >> >>>Is it possible to create an object holding holding 1 bit, 2 bit, 3 bit >> >>>that still can be treated as a numerical value that can be added and >> >>>subtracted, without bit operations? >> >>No. >> > >> > An attempt at implementing an object »holding« 8 bit: >> >> It seems unlikely that he meant can one store small whole numbers in >> 64-bit floating point variables. He's been doing that for months >> (years?). >> >> >> -- >> Ben. > > But what is this Ben? > > https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures Can you rely on Edition 6? I may have misunderstood your goal which I took to be a request for minimal sized objects. If you don't mind wasting bits, there are lots of ways to do what you ask (see other replies prompted by my "no" reply for some examples). But these new types only give you another kind of container into which to pack the data -- they don't allow you to do anything you could not do otherwise. -- Ben.