Some design suggestions

Bruce Cran bruce at cran.org.uk
Tue Jun 29 11:37:58 UTC 2010


On Mon, 28 Jun 2010 13:32:17 +0200
Karsten Behrmann <BearPerson at gmx.net> wrote:

> Not so.
> I do not feel it makes much of a difference whether a variable resides
> on the heap or somewhere in static data.
> 
> Context structures are essential when you need something more than
> once. However, I don't see us configuring two wholly distinct
> partitionings inside the same sysinstall session. It *IS* singleton
> state, and then we might as well store it easily into static
> variables.
> 
> I do not like having an extra state parameter to worry about, and
> doing state->root_partition is just that little bit more for my eyes
> to ignore than reading just root_partition.
> 
> Of course, this is personal preference. But I do not believe (static)
> globals should be unilaterally killed, they are quite useful. They
> have these advantages over environment variables:
> - arbitrarily typeable
> - clear ownership/responsibility
> - compiler enforces local-only access

As long as the globals are declared in a single place and are
restricted to the module, that sounds like a good idea: what I don't
like is where globals are scattered throughout the file, some being
declared at the top and some just before the function that uses them.
I've worked on too many .NET projects with far too many fields that
I've become very wary of globals!

-- 
Bruce Cran


More information about the freebsd-sysinstall mailing list