did you know you didn't have to use actual objects to implement object-like behaviour.

this has the effect that you can extend the "object" at will...

just use a block with set-word values.

I have no ideas about speed, just that this could be a solution to your problem

example:


>> object: [
        id none
        name none
]


>> object/name: "gary"
== [
    id none
    name "gary"
] 


== print object/name
gary


add a new item to object:
>> append object reduce ['field "chester the cat"]
== [
    id none
    name "gary"
    field "chester the cat"
]

>> print object/field
chester the cat


Some gurus on this list might might correct me, but in the context of your problem, 
this sounds like a fix to your problem.  You can also put functions in such a block 
and use it, BUT remember that self word is not set by default, you would have to add 
it to the function's arguments (like in python) and supply the block, to which the 
function is part of... like this:

object: compose [
    id none
    name "gary"
    field "chester the cat"
    status ( func [self][
        probe length? self
        foreach [item data] self [
                either (function! <> type? :data) [
                        print [item "=" data]
                ][
                        print [item "()"]
                ]
        ]
    ])
]

object/id: 1234
object/status object

8
id = 1234
name = gary
field = chester the cat
status ()



HTH!!!




-MAx




> === Original Message ===
> 
> 
> New version 0.18 of DyBASE Rebol API is available.
> Now it is not necessary to specify prototype object: DyBASE is able
> to fetch object with arbitrary set of fields. It is possible because
> now fetching of object is done in three steps:
> 1. Fetch object fields into the block
> 2. Create object using constructed block
> 3. Resolve references using load-object method
> 
> Certainly this approach is less efficient than used before
> (instantiation of fetched object using prototype object and
> assignment to object field using "set in" construction) but it is more
> flexible and performance penalty is not so large - about 50%.
> Also this approach makes it possible to change format of the objects
> without recreation of database.
> 
> New version of DyBASE is located at
> http://www.garret.ru/~knizhnik/dybase.html
> 
> -- 
> Best regards,
>  Konstantin                            mailto:[EMAIL PROTECTED]
> 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to