The make word

In the Using error? section in Chapter 4Code-Controlling Structures, we used probe to get more details of a specific error, and this returned an output starting with make error! [ ... ]. The error! is effectively an object that was constructed with make.

It turns out that make can be used to construct a new value for any datatype. It needs the type and, as a second argument, a specification for that type. This can be a value or a memory allocation, or another specification in the case of datatype!, native!, action!, routine!, and event!

Here are some examples:

;-- see Chapter06/objects.red:i: make integer! 5              ; == 5    ; (1)output: make string! 1000       ; == ""   ; (2)blk: make block! 20             ; == []   ; (3)

In line (1), the specification ...

Get Learn Red - Fundamentals of Red now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.