Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Tupleware

From: holger:rebol at: 22-Feb-2001 10:41

On Thu, Feb 22, 2001 at 12:32:21PM -0500, [Sanghabum--aol--com] wrote:
> Thanks for the information. I still think that, with a bit of imagination, > the tuple could become a much more usable datatype. > > Given that a tuple doesn't handle IPv6 addresses (which have 8 parts, each 1 > 16-bit number, usually expressed in hex, with a colon as a separator, and > with shorthand forms for omitting zeroes) perhaps there is a case for Carl to > sit down and rethink or extend the tuple concept.
Actually to do IPv6 addresses right you would need considerably more than 16 bytes. You would also need to store the scope identifier and, depending on use, perhaps a netmask length. There is a reason why tuples are limited the way they are: REBOL has two classes of values, those which fit into a "value slot", i.e. which are completely copied when a block containing those values is copied, and those which require additional storage subject to garbage collection, i.e. which have reference semantics when a block containing those values is copied. Simple types such as integer!, logic! and all words fall into the first category. Series, ports, objects, functions etc. fall into the second category. Tuples have a limited length and value space because they are considered simple types. This improves efficiency because it means that color values and IP addresses don't have to be garbage collected. If you need value sequences of arbitrary length then you have to use some type of series, probably a block of integers or a binary. IPv6 addresses will probably be a type by themselves, both because of the tuple limitation and because having a separate type allows them to be distinguished from other types by the scanner. -- Holger Kruse [holger--rebol--com]