REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 18-Aug-2010 Edit History  

REBOL 3 Datatypes: Refinement!

Contents

Concept

Refinements are modifiers, similar to adjectives used in natural (human) languages. A refinement indicates a variation in the use of, or extension in the meaning of, a function, object, filename, URL, or path. Refinements are always symbolic in their value.

Refinements are used for functions:

block: [1 2]
append/only block [3 4]

objects:

print system/version

files:

dir: %docs/core
print read dir/file.txt

urls:

site: http://www.rebol.com
print read site/index.html

Format

Refinements are composed with a slash followed by a valid REBOL word (see the words section below for definition). Examples are:

/only
/test1
/save-it

Refinements are usually joined to other words, such as in the case of:

port: open/binary file

But refinements can also be written alone, as is done when specifying refinements to a function:

save-data: function [file data /limit /reload] ...

Creation

Refinements can be created literally in source code:

/test

or can be composed from the to-refinement word:

probe to-refinement "test"
/test

Related

To test for a refinement, use the refinement? function:

probe refinement? /test
true
probe refinement? 'word
false


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin