Pushing the edge of ISSUE! for hex representations

Carl Sassenrath, CTO
REBOL Technologies
15-Jul-2009 16:50 GMT

Article #0222
Main page || Index || Prior Article [0221] || Next Article [0223] || 10 Comments || Send feedback

In REBOL, we use the binary! datatype for binary values, and they are represented in source code in variations of the form:


In R2, we wanted to easily support integer representations in hex, such as those used for HTML color values. So we allowed the use of the issue datatype, in the form:


And, we supported simple conversion to integer:

to-integer #01020304

That made some code easier, so we decided we would also support:

to-hex 1234

to return an issue for that integer, in hex format.

That's as far as we went in R2. It should be noted that issues are not a binary datatype, they are a string (character) datatype. This is legal:


In R3, we allow conversion to binary of other scalars, such as:

>> to-binary 1.0
== #{3FF0000000000000}

>> to-binary $1.0
== #{7F800000000000000000000A}

and, as a result, this casual usage of issues has grown:

>> to-hex 1.0
== #3FF0000000000000

>> to-hex $1.0
== #7F800000000000000000000A

But, this was a bit accidental. It did not come from a design goal.

We need to debate this practice and make a conscious decision if it should be supported or not. Although this form looks simple enough to convert, it actually isn't (because issues are strings, not binaries). So, allowing these issue formats adds more code to the REBOL executable than you'd expect. They are not freebies.

Let's decide this.


Updated 29-Mar-2017 - Edit - Copyright REBOL Technologies -