freeride-devel
[Top][All Lists]
Advanced

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

[FR-devel] results of little warings clean up


From: gabriele renzi
Subject: [FR-devel] results of little warings clean up
Date: Tue, 22 Jul 2003 17:38:14 +0200 (CEST)

sorry for the length of this message..
[note: this message is based on behviour with 1.8 on
windows. 
 I'll try 1.6.8 and linux as soon as possible, *bsd ,
macos, BeOS.. 
 well, send me an HD and I'll even try them ;)
]


I guys, last news from warning land...

I have to study, so, naturally, I can't do it, and I
spend my time messing up with FR 8-)

good news:
it seems that most of the warnings shown with
$VERBOSE=true are related to 4 things:

the first two are easy :

- uninitialized vars
- 'var_name = somevalue unless var_name'

For the first thing, I tried putting some
initializations like
var_name=nil in the various related 'initialize'
methods. 
This seemed to work with freebase/lib/databus.rb, in
class Slot
you can safely add to Slot#initialize the line 

 @address@hidden@address@hidden@address@hidden

and you'll remove many warnings.

Another place to do the same thing is in
plugins/rubyide_command/core_commands.rb
   class Command
     def initialize(slot)
+      @av_manager=nil


and in rubyide_tools_source_parser/basic_parser.rb, in
the initialize method from 

BasicRubyParser:

   def initialize
+    @last_hash=nil
     clear
   end


I think changes like this should not generate newer
bugs, cause initializing vars to nil should 

not cause problems, but this could happen if we are
doing things like

 ...
 possibly_initialized_var.method
  rescue NameError
  ...
 
anyway, I don't think this is a great risk.



For the second thing.. well, I dont know why this
happens but it seems that ruby dislikes 
 unless uninitialized_var
but goes quiet with
 uninitialized_var ||=x

you can do this change in   

freebase/configuration.rb
     def instance
-      unless @plugin_instance
-        @plugin_instance =
FreeBASE::Plugin.new(@configuration.core, self)
-      end
-      @plugin_instance
+        @plugin_instance ||=
FreeBASE::Plugin.new(@configuration.core, self)
     end


and in 

freebase/readers.rb

     def self.setup
-      $FREEBASE_APPLICATION = "freeride" unless
$FREEBASE_APPLICATION
+      $FREEBASE_APPLICATION ||= "freeride" 



Now, if I start fr with a couple of files and suddenly
close it 
I get 4312 warnings.
After this changes they are 280.

~90 of this are related to yaml.rb, cause I'm running
ruby 1.8 and it bothers about Object#id .
Changing it to Object#__id__ kills them all.

down to 191 lines of warnings!

Now, everything works fine for me *except*
search/replace. 
Starting FR (even fresh cvs) with -w cause it to crash
when I click on Search/find or I do 

CTRL+F:
E:/freeride/./plugins/rubyide_fox_gui/editpane.rb:817:
[BUG] Segmentation fault

possible solution: updating yaml.rb
It seems to me (possibly I'm wrong) that yaml.rb is
something generated with racc -E, that 

includes all the various file like this:
 file <<yaml_related_file.rb
  stuff
 yaml_related_file.rb
 eval file

(could'nt we put yaml.rb in redist?)

Anyway it is based on yaml.rb 0.40. 

If you install yaml.rb 0.60 , and replace all yaml.rb
contents with 
 require 'yaml'
search/replace works again.

Dunno why this happens, but possibly we could import
the latest yaml pure ruby distribution (even 

if the C based one, syck, seems to work fine IMO)..

Anyway, warn lines bump up to 600 if you do this,
mostly because yaml 0.60 seems to use 
 'string' =~ 'regex'
comparisons, that should become 
 'string' =~ /regex/


I don't know if this is fixed in the current yaml cvs.

The third warning pack seem related to the properties
for scintilla, that are eval'ed someway..
I don't know where this happens, possibly I'll
investigate.

The latest warning pack comes from
freebase/configuration.rb.. it seems instance vars for


PluginConfiguration are not initialized, but if I add
them to the initialize method.. they are 

still uninitialized.. I think I'll have to take a
closer look to this..



Conclusion: 
- FR run with -w is unsafe
- 4000+ warnings are easily eliminated
- maybe we should use a newer yaml.rb to reduce them
more and make FR safe again
- possibly this changes will introduce new bugs..
would we take the risk ?


cheers,
gabriele

=====
icq #69488917

______________________________________________________________________
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il 
filtro Anti-spam
http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/




reply via email to

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