[1/3] from: sanghabum::aol::com at: 22-Feb-2001 12:32
In a previous thread, [g--santilli--tiscalinet--it] writes re tuples
> They're used for IP addresses and colors, or anything similar. If > you need a generic "array of integers" you can use a block of > integers (integer! is 32 bit); or you can use strings as Rexx > does.
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. Yes, I have been using blocks of integers for structured numbers with parts that exceed 255. But a sort of "super-tuple" built-in datatype would be very handy indeed. Colin
[2/3] 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]
[3/3] from: sanghabum:aol at: 23-Feb-2001 17:02
> If you need value sequences of arbitrary length then you have to use some > type
<<quoted lines omitted: 4>>> a separate type allows them to be distinguished from other types by the > scanner.
Thanks for your detailed reply. I'd be very happy to see IPv6 addresses as built-in datatype. They are (or will soon become), fundamental identifiers on the Internet. You guys will have to write some nifty code to support them, but imagine the joy the rest us will have in writing code like: myIPAddress: make IP! 188.8.131.52 YourIPAddress: make IP! "0::1:2:3:ff" if myIPAddress = YourIPAddress [ print "same!] (Mine and your are the same address in this example, expressed in IPv4 and IPv6 formats). Regards, Colin.
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted