[Nitro] nitro 0.50: first encounter

Jimmy Jazz Jimmy.Jazz at gmx.net
Wed Jul 4 18:11:09 EDT 2007

Jonathan Buch a écrit :
>> 1. Collisions
> Not sure what's going on here, I'm hoping Arne can reproduce that.
> [22:16]  <arne_b> wait a sec, have to try something
> [22:18]  <arne_b> mmm can't reproduce the name clash

Also, I sent to both of you a hopefully functional example.

>> 2. Question: how does #{content :method} really work ?
> All I know is:  it's supposedly used for rendering 'sub elements'
> inside of an element.  I also know that it is a hash (which makes
> multiple same-named sub-elements impossible).
> In my early days of Nitro I have looked at these and shoved them
> away as too complex for my little mind to grasp.


>> 3. Annotation and elements
>> Also, i certainly misunderstood the annotation stuff ;)
> Yes you do.  :P
>> An example to illustrate the behavior:
>> class Blog::Controller
>>   ann :self, :element_namespace => Post
>> doesn't return an error and is linked to Blog::Controller::Post. I think
>> that is wrong ( it should be Raw::Element::Post)
> In the contrary, normal Ruby rules apply.  So, the constant
> `Post` will be looked up:  first Blog::Controller::Post, then
> Blog::Post, then Post.  Same applies to BlogPage, so the error isn't
> really surprising.  If you want absolute the 'correct' constant, use
> `::Raw::Element::BlogPage`.  There's no magic going on here, it's
> really just plain ruby lookup rules, annotations have nothing to do
> with that.
> Annotations are a system to 'tag information to a symbol'.
> `ann :self, :foo => :bar` adds merges the hash `{:foo => :bar}` into
> the information which is available on the symol :self.
> Too confusing?
> Just think of annotations as a way of saving/retrieving information.

I have be wrong to believe that :element_namespace (like the name could
have suggest) would help me to associate a Controller like
Blog::Controller to a particular Element Class like Raw::Element::BlogPage.

> Yes, quite normal, Webrick just is that way, for a better experience
> use mongrel.  :P
As soon as i will be more productive :P
>> 5. That is a bit Greek (Chinese?) to me
>> Some messages are really hard to understand and to debug and make the
>> source look fragile. That can be very frustrating especially if the
>> method are part of ruby language (e.g. each).
>> undefined method `each' for nil:NilClass
>>   (eval):3:in `post___html___view'
> Yes, I agree that this should probably better point to the template
> (I assume that's where the error comes from).  Perfect error reporting
> is one of the hardest things in a web-framework, really, especially
> with templates.
> I hope that George when he comes back can come up with a scheme where
> he can pinpoint the error better.
I'm sure he will :)

Thank you for your explanation



            |\      _,,,---,,_
      ZZZzz /,`.-'`'    -.  ;-;;,_
           |,4-  ) )-,_. ,\ (  `'-'
          '---''(_/--'  `-'\_)

More information about the Nitro-general mailing list