cons-discuss
[Top][All Lists]
Advanced

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

RE: Packages and cons


From: Gary Oberbrunner
Subject: RE: Packages and cons
Date: Wed, 18 Jul 2001 11:10:21 -0400

Johan Holmberg wrote:
 >
 > Isn't this just a complicated way  of doing, what could easier be
 > written like this:
 >
 > Construct file:
 >
 >      use Mystuff;
 >
 >      $CONS = new cons;
 >      $CONS->printhi;   # call new method

Yes, if you're willing to call all your 'utility' functions as methods, like
$CONS->printhi.  Since most of my utility functions don't require an
environment (they're what would in C++ be "static" methods), I'd prefer to
call them as bare functions, e.g. "printhi();".  So I prefer the solution
Johan and Frank suggested, which is to turn my Cons-subs.pl into ConsSubs.pm
(by the way, it seems module names can't have hyphens in them?) and 'use
ConsSubs' in each of my Construct/Conscript files.

It also does make sense to me that you can now look at any given Conscript
file and see where it's getting those method definitions.  Nothing's
"invisibly" imported from anywhere.  For the tiny amount of extra work, the
clarity is worth it.

Thanks all -- I really appreciate all the helpful comments from this list!

-- Gary Oberbrunner




reply via email to

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