freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FR-devel] FW: FXRuby issue


From: Rich Kilmer
Subject: [FR-devel] FW: FXRuby issue
Date: Wed, 13 Nov 2002 20:59:37 -0500

in case folks aren't following rubytalk...

-----Original Message-----
From: Rich Kilmer [mailto:address@hidden 
Sent: Wednesday, November 13, 2002 8:50 PM
To: ruby-talk ML
Subject: Re: FXRuby issue


One other one in responder2.rb:

SELTYPE(sel) needs to be Fox::SELTYPE(sel)

-rich

> -----Original Message-----
> From: Rich Kilmer [mailto:address@hidden
> Sent: Wednesday, November 13, 2002 8:43 PM
> To: ruby-talk ML; address@hidden
> Cc: address@hidden
> Subject: Re: FXRuby issue
> 
> 
> Lyle,
> 
> I already made this change to FreeRIDE this afternoon.  Every
> class that uses Fox constants now specifically includes Fox.  
> I agree that this is better/safer from a namespace 
> perspective.  Are you going to patch FXRuby with the changes 
> I/you list here (explicit reference to Fox:: in responder.rb 
> and responder2.rb)?
> 
> Thanks for always being so supportive!
> 
> Regards,
> 
> Rich
> 
> > -----Original Message-----
> > From: address@hidden [mailto:address@hidden
> > Sent: Wednesday, November 13, 2002 7:35 PM
> > To: address@hidden
> > Cc: address@hidden
> > Subject: Re: FXRuby issue
> > 
> > 
> > 
> > On Wed, 13 Nov 2002 15:07:41 -0500, "Rich Kilmer" 
> > <address@hidden> wrote :
> > 
> > > I had to patch responder2.rb and responder.rb to make Fox
> work on my
> > > machine:
> > > 
> > > responder2.rb:
> > > 
> > > 36. @pseudoTarget = Fox::FXPseudoTarget.new
> > 
> > Yes, this one I'm OK with.
> > 
> > > responder.rb:
> > > 
> > > 7. include Fox
> > 
> > No; doing this would pollute the global namespace (more on that in a

> > moment). A better solution is to use the fully-qualified names for 
> > the various Fox module-level methods and constants that the 
> > Responder module methods need, e.g. this code:
> > 
> >   # Define range of function types
> >   def FXMAPTYPES(typelo, typehi, func)
> >     addMapEntry(MKUINT(MINKEY, typelo),
> >                 MKUINT(MAXKEY, typehi),
> >                 func)
> >   end
> > 
> > becomes:
> > 
> >   # Define range of function types
> >   def FXMAPTYPES(typelo, typehi, func)
> >     addMapEntry(Fox::MKUINT(Fox::MINKEY, typelo),
> >                 Fox::MKUINT(Fox::MAXKEY, typehi),
> >                 func)
> >   end
> > 
> > I did a little digging to try to understand why FXRuby worked the 
> > way it did in version 1.0.13 and what changed in version 1.0.14, and

> > I think it all boils down to some changes made to 'responder2.rb'. 
> > For some time (i.e. at least in version 1.0.13 and perhaps earlier) 
> > it has been true that when you require the 'fox' feature:
> > 
> >     require 'fox'
> > 
> > it was also requiring some of the FXRuby library modules, and in 
> > particular it was doing:
> > 
> >     require 'fox/responder2'
> > 
> > Now for FXRuby-1.0.13, the beginning of 'responder2.rb' looked like 
> > this:
> > 
> >     require 'fox'
> >     require 'fox/responder'
> >     
> >     include Fox
> > 
> > and that last line was the culprit: it was dumping
> > *everything* from the Fox module into the global namespace,
> > which kinda defeats the purpose of having put those things 
> > into their own module in the first place. This code was 
> > changed in version 1.0.14, where 'responder2.rb' no longer 
> > "include"-s the Fox module into the global namespace.
> > 
> > So the behavior in FXRuby versions 1.0.14 (and later) is "safer" in 
> > the sense that none of the stuff from the Fox module should ever 
> > escape into the global namespace unless you explicitly make it so 
> > (i.e. by doing an 'include Fox' at the top level). Since this is the

> > behavior you were relying on, is it possible to just modify the 
> > affected FreeRIDE
> > file(s) to do an 'include Fox' immediately after they require
> > 'fox'? [I realize that I am asking this question without 
> > knowing how many source files we're talking about.] Making 
> > this change to the FreeRIDE sources would have the 
> > consequence that everything from the Fox module will get 
> > dumped into the global namespace -- but that's what was 
> > happening *anyways* when you were running with FXRuby 1.0.13 ;)
> > 
> > 
> 
> 
> 
> 
> 










reply via email to

[Prev in Thread] Current Thread [Next in Thread]