25 Nov 18:52
Re: Why inheriting the package?
From: Josh Cherry <jcherry <at> ncbi.nlm.nih.gov>
Subject: Re: Why inheriting the package?
Newsgroups: gmane.comp.programming.swig
Date: 2008-11-25 17:52:33 GMT
Subject: Re: Why inheriting the package?
Newsgroups: gmane.comp.programming.swig
Date: 2008-11-25 17:52:33 GMT
On Tue, 25 Nov 2008, John Ky wrote: > I just discovered that swig generated perl classes inherit from the parent > package: > > package example::Vector; > @ISA = qw( example ); > > Why does it do this? It's causing me trouble because I can't then add > additional helper functions to the package that have the same name as method > names. My understanding is that this is done to give support methods to all classes. See, e.g., the method TIEHASH defined in the parent package. I think a better way to do this would be to put these methods in a sub-package (class) and have everything inherit from that. With the current set-up, some confusion between methods and non-member functions is possible. However, I don't see why it would prevent you from adding functions with the same names as methods, unless you're using a fairly old version of SWIG (it used to put the package before other bases, but now puts it after; I'm not sure why subclasses need it at all). Josh ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world(Continue reading)
RSS Feed