[GAP Forum] Packages and global functions
Laurent Bartholdi
laurent.bartholdi at gmail.com
Sat Apr 28 19:35:02 BST 2007
Dear Yevgen, dear forum,
I have written a package that deals with 'automata groups', called
"FR" (available on my webpage) and can explain a few of the design
decisions I took. Either the remarks below will be helpful to you, or
someone from the forum will correct me.
> Should packages use operations as much as possible? It sounds
> sensible since methods can be overridden as one wishes, and
> operations with the same name can be declared for different
> types safely. It doesn't solve the problem with category names
> of course, but that's easier to deal with - a category with obscure
> name is fine as long as user doesn't have to type it in (unlike
> actual methods which are going to be used by a user).
It seems that too much overloading causes performance loss. Therefore,
it's good practice, if you know in advance which method will be used,
to call the right one immediately. Therefore, e.g., automata have a
'Degree'. I have installed a method called 'DegreeAutomaton', which is
used inside my code. For convenience of the user, I have also
overloaded the general 'Degree' method. The idea is that a method
lookup is inexpensive for a user, but may be costly within a
subroutine.
>
> And related to this is real question, about namespaces. Are there
> some plans to implement something like that in GAP? Some
> method to separate names in a package would be awesome.
> At the moment there are about million global names, and you
> never know what your package will conflict with.
I have created a single global variable 'FR_LOCAL', which is a record.
this record contains all the local functions and variables of my
subroutines.
Best regards, Laurent
--
Laurent Bartholdi \ laurent.bartholdi<at>gmail<dot>com
EPFL SB SMA IMB MAD \ Téléphone: +41 21-6935458
Station 8 \ Secrétaire: +41 21-6935471
CH-1015 Lausanne, Switzerland \ Fax: +41 21-6930339
More information about the Forum
mailing list