Steven White napsal(a):

>This is a question, but it also might be an example of what is hard about =
>REBOL.  One can look at the dictionary to find out what one "can" do with =
>REBOL, but that doesn't necessarily tell what one "must" do or "should" =
>do.
>
>I want to write a re-useable module for printing.  It will contains some =
>functions, plus some data that is used by the functions.  I will put the =
>module into a larger program with the "do" command.  I have done that =
>before, know how to do it, no problem.
>
>In this module I will have to name the functions and data.  For example,
>=20
>    PAGE-SIZE: 58
>    PRINT-BEFORE-1: func [ etc. ]
>
>Now, IF I named them as above, and then at some future time wrote another =
>re-useable module, AND happened to use those same names because I forgot =
>about the first module, AND I used both modules in a program, THEN there =
>would be a problem with conflicting names.
>
>So, what I would do in my "native" language, and what I could do in REBOL, =
>is put a prefix on all data names in the module, like
>
>    PRT-PAGE-SIZE: 59
>    PRT-PRINT-BEFORE-1: func [ etc. ]
>
>This prefix would be used only in this one module, and so would give me =
>unique names.
>
>BUT, the question is, is that what one SHOULD do in REBOL, or is there =
>another approach, specifically, the CONTEXT statement?  Is the CONTEXT =
>statement intended to be the solution to this problem?  Am I supposed to =
>code something like
>
>    PRT: context [
>        PAGE-SIZE: 58
>        PRINT-BEFORE-1:  func [ etc ]
>    ]
>
>and then refer to PRT/PAGE-SIZE and PRT/PRINT-BEFORE-1?
>
>Thank you.
>
>
>Steven White
>City of Bloomington
>1800 W Old Shakopee Rd
>Bloomington MN 55431-3096
>USA
>952-563-4882 (voice)
>952-563-4672 (fax)
>[EMAIL PROTECTED]
>
>  
>
hi Steven,

my approach is as follows:

    context [
        page-size: 58
        set 'print-before-1 func [etc]
    ]

My context is anonymous, as opposed to your solution. I discern the 
words that I want to access only locally and the words that should be 
available globally. e.g. 'print-before-1 may be a global word, while 
'page-size will be a local word not supposed to be accessed globally.

-L
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to