Gee it took a while for me to realise...

context takes a block! as an argument - which constrains what context can
do- it can only take a block as a spec.

compare this with the following which can use an object as a spec

    template-object: context [
        name: does [print "template"]
        template-function: does [print "template func"]
    ]
    spec-object: context [
        name: does [print "spec"]
        special-function: does [print "special"]
    ]
    specialised-object: make template-object spec-object

so if you do

    probe specialised-object

you get

    make object! [
        name: func [][print "spec"]
        template-function: func [][print "template func"]
        special-function: func [][print "special"]
    ]

Brett.

----- Original Message -----
From: "Brett Handley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 12, 2001 9:31 PM
Subject: [REBOL] Re: Use of 'context


> > I recently discover the 'context word, but I do not see what
functionality
> > it adds compared to the creation of an object :
>
> Currently doesn't add any functionality, but does add readability.
>
>     >> source context
>     context: func [
>         "Defines a unique (underived) object."
>         blk [block!] "Object variables and values."
>     ][
>         make object! blk
>     ]
>
> >What does RT means by "underived" (perhaps
> > "un-inherited") ?
>
> I suspect just that it is a new object as opposed to one created like the
> following
>
>     first-object: context [name: "first"]
>     derived-object: make first-object []
>
> Brett.
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to