REBOL Technologies

Comments on: Mixed Dialects and the REDUCE/only Refinement

Carl Sassenrath, CTO
REBOL Technologies
7-Dec-2004

Article #0061
Main page || Index || Prior Article [0060] || Next Article [0062] || Post Comments || Send feedback

Starting with 2.5.58 there will be a method to directly support "mixed dialects". A mixed dialect is one that requires REBOL variable lookup, but not the evaluation of functional datatypes. Dialects such as DRAW, EFFECT, PARSE, and others such as those used with REBOL/Services are examples. Functional datatypes are not allowed in these dialects for safety reasons. For example, you may want to add an effect or draw a graphic as part of an icon in a desktop (as is the case in REBOL/View) or within a messaging system (as was done in the IOS conference and messaging reblets several years ago). To allow the dialect to evaluate a function directly would be to allow it to take control over the entire application.

Here is an example. Let's say you have an object that contains an image, and you want to supply that image to a command within the DRAW dialect. You might want to write such a expression as:

gob: context [
    where: 100x100
    image: load %tree.jpg
    ...
]
view layout [
    box 200x200 effect [draw [image gob/image gob/where]]
]

Currently, this would produce an error, because the DRAW dialect does not allow references to paths. However, in the next version of REBOL it will allow this usage. This is also true for the EFFECT and PARSE dialects.

The generalization of this concept is the REDUCE/only function refinement. REDUCE/only will allow only the lookup of words and paths and will not evalute functions nor allow SET. In addition, it will let you specify a block of keywords that you prefer to leave as is, without any lookup.

Here is an example of its use:

>> time: now/time
== 15:08:22
>> reduce/only [REBOL system/product at time] [at REBOL]
== [REBOL Base at 15:08:22]

If no keywords are needed, a NONE can be provided for that argument.

Post Comments

Post a Comment:

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

Name:

Blog id:

CS-0061


Comment:


 Note: HTML tags allowed for: b i u li ol ul font 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.

Updated 24-Jul-2014   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code