librelist archives

« back to archive

Why must external modules of Shoes 3 apps reference Shoes class?

Why must external modules of Shoes 3 apps reference Shoes class?

From:
i5m
Date:
2010-02-23 @ 15:50
Dear Shoes Folk,

please could someone explain this to me: In Shoes 2 I could have a module in
an external file and create a slot and use ":attach  => Window". However in
Shoes 3 I must use ":attach => Shoes::Window" as otherwise I get
"uninitialized constant UI::Window"

Probably better explained with an actual example:
http://gist.github.com/312280

Is this because of changes in Shoes or because of differences between Ruby
1.8 and 1.9? (I ask that because I have a Shoes 3, version 1229, built with
Ruby 1.8 that works as per Shoes 2)

Cheers,

i5m

P.S. I'd no idea what to put for the subject.


-----------------------
i5m.co.uk
GPG Key: 0xA18A602B

Re: [shoes] Why must external modules of Shoes 3 apps reference Shoes class?

From:
Satoshi Asakawa
Date:
2010-02-24 @ 13:59
Hi i5m,

I didn't check commit list, but I guess this is because of changes in Shoes.

Look at _why's comment in ruby.c, line 4636-4637:

  // I want all elements to be addressed Shoes::Name, but also available in
  // a separate mixin (cTypes), for inclusion in every Shoes.app block.

I guess he added `module Shoes` into Policeman.
So, Policeman has the following structure:

  module Shoes
    class Window < Object
    class Mouse < Object
    class Canvas < Object
    class App < Object
       :
       :

Hope this helps,
ashbb

Re: [shoes] Why must external modules of Shoes 3 apps reference Shoes class?

From:
i5m
Date:
2010-02-24 @ 14:10
Thank you, yes that's a great help.
-----------------------
i5m.co.uk
GPG Key: 0xA18A602B


On Wed, Feb 24, 2010 at 1:59 PM, Satoshi Asakawa <ashbbb@gmail.com> wrote:

> Hi i5m,
>
> I didn't check commit list, but I guess this is because of changes in
> Shoes.
>
> Look at _why's comment in ruby.c, line 4636-4637:
>
>   // I want all elements to be addressed Shoes::Name, but also available in
>   // a separate mixin (cTypes), for inclusion in every Shoes.app block.
>
> I guess he added `module Shoes` into Policeman.
> So, Policeman has the following structure:
>
>   module Shoes
>     class Window < Object
>     class Mouse < Object
>     class Canvas < Object
>     class App < Object
>        :
>        :
>
> Hope this helps,
> ashbb
>
>