REBOL 3.0

Comments on: 64 bit ports

Carl Sassenrath, CTO
REBOL Technologies
16-Mar-2007 17:02 GMT

Article #0068
Main page || Index || Prior Article [0067] || Next Article [0069] || 5 Comments || Send feedback

The potential size of files has changed since REBOL 2.0 was released. It was once highly unlikely that you'd refer to a file larger than 2GB. These days, it's become a regular thing for many users.

The new port design of REBOL 3.0 is now 64 bit. Both the size of the file and the index into the file are 64 bit.

So, this code will work for "any size" files:

f: open/binary %from-file
t: open/binary/new %to-file
while [data: take f 100000] [append t data]
close f
close t

A few notes:

  1. What's that take function? For now, just think of it as a copy with a remove. Unlike copy, take eats the input. This works for all series, not just ports. (I need to discuss take in a separate article.)
  2. There is a subtle but important change shown here. Do you see it? In R3, a port index is no longer part of the reference, it is part of the port value. But, that's also the subject of another article.

5 Comments

Comments:

Maxim Olivier-Adlhoch
16-Mar-2007 15:58:15
'TAKE

cool ! :-)

although we could consider this a helper... for any buffered operations, its soooo much more explicit. I guess its native too ?

Edoc
16-Mar-2007 16:21:43
Nice example demonstrating the new native 'append as well.
Gregg Irwin
17-Mar-2007 14:49:39
The demo code will work for any size file, but without /direct or /skip, you might need a lot of memory. :)
Gregg Irwin
17-Mar-2007 14:50:30
That is to say, handling huge files will be great, but not terribly useful without those supporting features.
Maxim Olivier-Adlhoch
17-Mar-2007 18:44:13
if the new ports can handle buffered I/O implicitely, its very nice... which is what the above seems to indicate since he copies a fixed amount of bytes and traverses the source.

appending it to the output (not writing the file out in one go)

Post a Comment:

You can post a comment here. Keep it on-topic.

Name:

Blog id:

R3-0068


Comment:


 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote
 
 

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

REBOL 3.0
Updated 20-Apr-2024 - Edit - Copyright REBOL Technologies - REBOL.net