I might get in trouble with the with-Nazis for this, but I came up
with what I think is a cool class definition pattern for Prototype,
that gives you visibility over Class attributes, similar to what you
would experience in more static languages:

var Foo = Class.create();
Object.extend(Foo, {
  A_CLASS_CONSTANT: 42,
  a_class_method: function() {
  }
});
with (Foo) addMethods({
  an_instance_method: function() {
    alert(A_CLASS_CONSTANT);
    a_class_method();
  }
});

Apart from the usual 'with' pitfalls, it's pretty clean.

Any thoughts?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to