# Comments Within Binary Values

**URL:** <https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423>\
**Category:** Datatypes\
**Created:** [December 4, 2020, 12:13am UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423 "2020-12-04T00:13:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rgchris](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/rgchris/32/14_2.png) [@rgchris](https://revolt.metaeducation.com/forum/u/rgchris)\
**Post date:** [December 4, 2020, 12:13am UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/1 "2020-12-04T00:13:30Z")

</div>

Should this be permitted? Here is an annotated PNG:

```plaintext
#{
89504E47 ; PNG Signature
0D0A1A0A ; Integrity Check

0000000D ; Chunk Length
49484452 ; Chunk Name (IHDR)
    00000001 ; Width
    00000003 ; Height
    08 ; Colour Depth
    06 ; Colour Type
    00 ; Compression Method
    00 ; Filter Method
    00 ; Interlace Method
52DD6582 ; Chunk CRC

0000000F ; Chunk Length
49444154 ; Chunk Name (IDAT)
789C63608083F894A8FF00046A021D ; Image Data (GZIP compressed)
54C10693 ; Chunk CRC

00000000 ; Chunk Length
49454E44 ; Chunk Name (IEND)
AE426082 ; Chunk CRC
}

```

Neither Rebol 2 nor 3 supported this, however Red does. A couple of notes—the above example would be the case _for_, _against_ is the already-noted vapourizing comments and the complexity of potential codec that supported comment-preservation

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [December 4, 2020, 2:50am UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/2 "2020-12-04T02:50:58Z")

</div>

It's not the worst idea. Though I'm not sure how realistically useful it is. How often are you documenting a giant chunk of literal binary data...where you're not composing generated values into it?

```
join binary! [
   #{89504E47} ; PNG Signature
   #{0D0A1A0A} ; Integrity Check

   (enbin [BE + 4] chunklength)
   #{49484452} ; Chunk Name (IHDR)
   ...
]

```

---

<div class="post-metadata">

**Author:** ![Mark-hi](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/mark-hi/32/212_2.png) [@Mark-hi](https://revolt.metaeducation.com/forum/u/Mark-hi)\
**Post date:** [December 4, 2020, 4:41pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/3 "2020-12-04T16:41:51Z")

</div>

I see a clear need for this (in fact I see a need for this for other things besides binaries). There will be times when interpretation is unavailable yet complex data needs to be loaded. To prohibit commenting in such a scenario would be more than unfortunate.

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [December 4, 2020, 5:27pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/4 "2020-12-04T17:27:35Z")

</div>

> [@Mark-hi](#):
>
> There will be times when interpretation is unavailable yet complex data needs to be loaded.

Worrying a lot about situations when "interpretation is unavailable" is a rather expansive domain in which you can't really overthink too much if you are writing an _interpreter_.

The rare cases where it might happen sounds like a place to use PARSE to accrue your BINARY! from a format that could be more clever than any single concern we might think to address.

---

<div class="post-metadata">

**Author:** ![Mark-hi](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/mark-hi/32/212_2.png) [@Mark-hi](https://revolt.metaeducation.com/forum/u/Mark-hi)\
**Post date:** [December 4, 2020, 8:32pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/5 "2020-12-04T20:32:48Z")

</div>

So you are saying define a commented-format, write a stand-alone program to translate that commented-format into an uncommented-format, then load the uncommented-format? Three steps and a separate executable utility that needs its own source code and maintenance? I understand wanting to off-load as much work onto the user as possible, but suggesting that commenting is not a worthy concern different from all other ways to dynamically build unreadable things in order to justify requiring this is dodging at best.

---

<div class="post-metadata">

**Author:** ![hostilefork](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/hostilefork/32/421_2.png) [@hostilefork](https://revolt.metaeducation.com/forum/u/hostilefork)\
**Post date:** [December 4, 2020, 8:35pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/6 "2020-12-04T20:35:50Z")

</div>

> [@Mark-hi](#):
>
> So you are saying define a commented-format, write a stand-alone program to translate that commented-format into an uncommented-format, then load the uncommented-format?

I'm saying that despite the claim that this comes up a lot, it simply doesn't. In the rare case "something like it" does come up, I imagine the problem is actually more nuanced and would require a better solution than we can guess at. All the cases I can imagine caring about would need to be structured for escaped slots, at which point you've got your comment opportunities.

The example given was artificial. You don't have PNG bytes being written up where the fields have been filled in like that in anything but documentation of an example format. Such binaries put to disk would actually be stored as bytes and not text...there is not a market for "annotated hex-encoded bytestreams" that we need to be serving in any more condensed way than **#{DECAFBAD} ; comment**. (If it were a huge market somehow, then we should adopt whatever that huge market has standardized upon.)

When people embed bytes into a script for convenience to transmit data in band and with the script, they typically want to do it compressed (comments largely pointless on individual compressed bytes)...and more often as base64 vs. hex anyway.

There's a lot of things that need more attention and upkeep.

---

<div class="post-metadata">

**Author:** ![IngoHohmann](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/ingohohmann/32/195_2.png) [@IngoHohmann](https://revolt.metaeducation.com/forum/u/IngoHohmann)\
**Post date:** [December 4, 2020, 11:42pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/7 "2020-12-04T23:42:14Z")

</div>

I don't know of any binary format that embeds comments like that (granted, that doesn't say much), so I don't see any win in allowing it.

---

<div class="post-metadata">

**Author:** ![rgchris](https://revolt.metaeducation.com/forum/user_avatar/revolt.metaeducation.com/rgchris/32/14_2.png) [@rgchris](https://revolt.metaeducation.com/forum/u/rgchris)\
**Post date:** [December 6, 2020, 7:23pm UTC](https://revolt.metaeducation.com/forum/t/comments-within-binary-values/1423/8 "2020-12-06T19:23:09Z")

</div>

This was [an example](https://github.com/9214/red/blob/f28da794e2d38913884d8c27ef48f22c812349dd/runtime/redbin.reds#L57-L63) Oldes posted in the Red group.
