Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9083125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:42:32+00:00 2026-06-16T20:42:32+00:00

Consider the following: >> bin: to-binary {Rebol} == #{5265626F6C} >> parse/all bin [s: to

  • 0

Consider the following:

>> bin: to-binary {Rebol}
== #{5265626F6C}

>> parse/all bin [s: to end]
== true

I expect s to have captured the head of the binary series, and be of type BINARY!. In Rebol 3 this is the case:

>> type? s
== binary!

>> s == bin
== true

In Rebol 2, it seems that parse must have converted the data to a string (or at least be “imaging” the binary as a string! under the hood, and not comparing equal)

>> type? s
== string!

>> s == bin
== false

Because Rebol 2 is not Unicode, a binary byte string and a character string are basically equivalent. But with Rebol 3’s Unicode I surmise you could end up with very different behavior if you wrote:

parse/all to-string bin [s: to end]

Because it would start interpreting multiple byte sequences into the string encoding, which doesn’t work if what you really wanted was uninterpreted bytes. 🙁

If one wants to write code that works in either Rebol 2 or Rebol 3 equally well in parsing BINARY!, how would you work around this? (Ideally making Rebol 2 act more like 3, of course.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:42:33+00:00Added an answer on June 16, 2026 at 8:42 pm

    Indeed, Rebol 2 is actually just “imaging” the data as a STRING! and not copying it, notice the following

    >> bin: to-binary {Rebol}
    == #{5265626F6C}
    
    >> parse bin [s: (clear s)] 
    == true
    
    >> s
    == ""
    
    >> bin
    == #{}
    

    That’s because Rebol 2 had routines available for aliasing string data as binary and vice-versa: AS-BINARY and AS-STRING. Unlike their TO-BINARY and TO-STRING variants, they do not actually make copies of the data.

    Here’s one idea that you (ummmm, well, I) could try…make a compatibility function (let’s call it bin-pos):

    bin-pos: func [pos [binary! string!]] [
        return either string? pos [
            ;; we must be using r2, image the parse position back to binary
            as-binary pos
        ] [
            ;; just a no-op in r3, binary parse input yields binary parse positions
            pos
        ]
    ]
    

    So in the above example, for Rebol 2 the right thing happens, if anywhere you would use s you instead substitute bin-pos s:

    >> type? (bin-pos s)
    == binary!
    
    >> (bin-pos s) == bin
    == true
    

    For cases where you use the COPY dialect word and a new string is made, the same technique will work…but perhaps a different wrapper name should be used. bin-capture?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how do I seek beyond end of existing file ? Consider I have test.bin
Consider following make: all: a b a: echo a exit 1 b: echo b
Consider following scenario: I have RESTful URL /articles that returns list of articles user
Consider the following Perl code. #!/usr/bin/perl use strict; use warnings; $b=1; my $a=${b}; $b=2;
Consider the following: me@mine:~$ cat a.sh #!/bin/bash echo Lines: $LINES echo Columns: $COLUMNS me@mine:~$
Consider the following code snippet: #!/bin/bash #This program tests the if statement in bash.
Consider the following script: #!/bin/bash function long_running { for i in $(seq 1 10);
Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies): using Facebook; var app
Consider the following command which runs flawlessly using bash : java -classpath bin:lib/* FunctionalTests.TestRunner
Consider the following code and its output: Code #!/usr/bin/perl -w use strict; use Data::Dumper;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.