Alan McKean wrote:
I like your suggestions to make it more Rubyish. I will fix it up.I only
did it (created an instance variable @people) because I knew how to do
it. Is people (in your example) a local variable and is there an API for
creating locals?
people gets created as an attribute:
class Foo
attr_accessor :people
end
Foo.new.people = blah # calls Foo#people=(arg) to assign @people
puts Foo.new.people # calls Foo#people to retrieve @people
Your persistent method would do something similar...
def persistent(symbol)
self.class.class_eval {
attr_accessor symbol
}
name = symbol.to_s
...
And then in the actual code:
persistent :people
people.store(person)
Note also that attributes need to be prefixed with "self." or they will
be treated as local variables...but it doesn't look like your code would
be setting people often:
self.people = something # ok, calls attr setter
people = something # not ok, people is a local var
>> people << person
>
> This, too.
You may or may not want this. It works for me, but a lot of people will
want the more explicit "store".
> Although the serialization is meant for any vm, the persistence only
> works in ours. It's a certified JVM that we licensed from Sun and has
> low-level tweaks for transparent persistence. It is based on a shared
> page cache. Objects that are put into the page cache are faulted in and
> out on demand.
>
> We intend to make a vm available along the same lines as we are doing
> with the Seaside product: free for one server and up to 4 gig of data.
> After that, its a few thousand (price to be determined). For many
> applications, the free version will be perfect.
>
> We are currently in early alpha stage with our Java 1.6 port of the
> product, so it is not generally available yet. When it reaches beta
> (about a month), we will be happy to distribute it to the dev group.
Very interesting! I look forward to seeing it soon :)
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email