Thursday, August 2, 2012

Realpolitick

It is simply amazing how many ways we can divide people: conservative, liberal, rich, poor, Republican, Democrat, compassionate, greedy. You guessed it - I'm listening to the presidential race on talk radio again. Conservative radio hosts make this race about conservatives and liberals. The politicians themselves talk about Republican versus Democrat. The president pits poor against rich. Everyone has reasons for their position. And the opponent has a compelling counter-example. Class warfare is alive and well!

As it should be. Huh?

No, I'm not writing a diatribe against class warfare. I'm writing a diatribe in favor of it! I agree that class warfare exists. I disagree with the classes. The Bible clearly divides people into classes: sheep and goats, sons and enemies, righteous and wicked. Money and politics are merely secondary issues.

Start at the beginning

Dave Ramsey describes personal finances as 20% knowledge and 80% behavior. Tom Stanley takes it even further in his books The Millionaire Mind and The Millionaire Next Door. Mindset - character - drives behavior. Improving finances involves not just doing what rich people do. It means being the same kind of people.

What, you mean greedy and self absorbed? I can do that!

No, that's not what I mean. Where does money come from? How does one become rich?

Well by working hard, saving instead of spending, discipline, and perseverance.

Bzzz! Wrong answer. Thank you for playing. You get rich by blind luck. Follow me for just a moment here. At some point, every business owner took a risk. Yes, they put research and elbow grease into their venture. They mitigated the risks through knowledge and hard work. But in the end, any one of a million adversities could have completely taken their head off, leaving a bankrupt shell of a person. In many cases, this happened several times before the one successful venture!

In any business, a thousand things completely outside of your control can go wrong. And in the earliest stages, you are vulnerable. You cannot avoid risk. That raises the question, why did none of those things happen this one time? It wasn't you. Remember, these events are beyond your control. Blind luck.

I don't believe in blind luck. And truth be told, neither do you. These events are beyond my control. They are not beyond all control. The Bible shows us that God exercises sovereign control over all things. And by sovereign, I mean absolute and total. Those events that never happened? God did that. God blessed your venture for His own pleasure. Money, aka riches, are a gift from God.

The nature of a gift

Gifts are an act of generosity from the giver. Gifts never expect anything in return - otherwise it's a reward or bribe. Gifts are not earned. They are given solely at the whim of the giver. Wake up - this is the important part. Money is a gift from God, given solely at His whim. You do not earn money. You are not entitled to anything no matter how hard you work. God gives it.

Why does God give us these gifts? Because it pleases Him. Really, it's that simple. He likes it! And He enjoys our gratitude when we understand just how much He gives.

Through the Bible, God let us know what pleases Him. And He stated, as a fact, that He showers gifts on people who please Him. In other words, the path to riches is doing what pleases God.

Now I want to be very clear - following the law (i.e. doing what God told us to do) does NOT entitle you to a lot of money. This is not a deal. Paul made tents to earn money for food. And he certainly obeyed God! We should obey God because He told us to. Sometimes, at His whim, He responds by giving gifts of wealth.

This why it is so STUPID to divide people into rich and poor. The same God who provided one man with wealth gave another just enough. And He did it as He saw fit. Wealth is NOT a measure of God's favor. It is just one possible conduit for His gifts.

Did God do it wrong?

The people who preach re-distribution of wealth believe that He did. If wealth is a gift from God, then it follows that He chose the people who receive it. By taking from them, you believe that God made a mistake. Seriously, you want to stand in front of the God who created heaven and earth, rests his feet on our world, wears the stars as a crown, tells the wind where to blow, keeps us moving around the sun in a safe orbit, and tell Him that He was wrong?

Now having said that, God Himself tells us to give away part of that gift. Notice that He never tells you that you have the right to take it. He instructs the recipient of His gift to reflect His generosity. Our giving builds the same generosity in our spirit. Taking builds selfishness.

Putting the "class" in class warfare

Okay, so we have debunked the idea of wealth as a class divider. If class warfare exists, then what are the sides? I propose that we label them righteous and wicked.

You see, people like wealth because it's so easy to see. Politicians like it because wealth is easy to fake. Character, on the other hand, is harder to hide. So many folks in the news today make it a point of pride that they focus on the issues. "I don't care about their personal life. Do they agree with me on most issues?" That's foolish.

Proverbs teaches us that even the kindest acts of the wicked are cruel. Look at President Obama. A lot of Americans agreed with his stand on "the issues" in 2008. They conveniently ignored the fact that he's a known liar. And they seemed genuinely surprised when, duh, he lied to them. Character matters. Opinions change. Politicians can and should change positions as they learn. Character lasts forever. One righteous man (or woman) who disagrees with me on everything will do more for this country than a dozen politicians who tell me what I want to hear. Of course, if I disagree with a righteous person, maybe my positions aren't so good?

Perl Modules and Packages

This morning, someone posted a question on the Perl Beginner's mailing list about functions. They use two modules. Each module has its own collection of utility functions. For the first module, the code calls the functions directly - with just the function name. With the second module, the code puts the module name in front of the function names. The poster asked why the difference?

One of the Perl experts on the list asked if the functions lived in a module or a package. There is a difference. And the difference is very important. I thought it helpful to explore.

What's in a name?

Let's start with a discussion on namespaces. Consider the variable named $a. Its name is, well, a. So your code declares $a and assigns it a value:

    my $a = 6;
    ...
    $a += 3;
    print "$a\n";

Now imagine that we include a module named foo. foo also has a variable named $a.

    # Main program
    my $a = 6;
    ...
    use foo;
    $a += 3;
    print "$a\n";

    #-------------
    # Module "foo"
    my $a = 27;

The code above prints 30, not 9! What happened? The definition of $a in module foo overrode our main program. Both places referenced the same variable: $a. Now imagine that every module on CPAN clobbered variables in your code! You would rename all of your variables every time you use a new module.

Perl solves this problem by putting a namespace in front of every variable name. Internally, Perl translates $a into $main::a. Technically, you can put $main::a in your code and it works. But why type all of those extra characters when Perl does the work for you?

I picture namespaces like boxes. All of the variables from your main program go into a box named main::. All of the variables from foo go into a box named foo::

    +-----------+     +-----------+
    | main::    |     | foo::     |
    +-----------+     +-----------+
    | $a = 3    |     | $a = 27   |
    | $b = 'hi' |     | $h = 'oh' |
    | $c = 10   |     | $x = 30   |
    +-----------+     +-----------+

The big match: Module versus Package

Modules are files that you can include. A module uses the same namespace as the code that included it. When we say use foo, Perl puts all of foo's variables in the main:: namespace.

Packages create namespaces. The package foo puts all of its variables in the namespace foo::. You create a package with the package command.

You use modules. The module declares a package.

So back to our original poster's question. He has two files (aka modules). That first module drops its functions into the main:: namespace. It is a module in the truest sense - a file that simply inserts itself into the code. The second module contains a package statement. Perl creates a namespace and puts the functions in there. To call those functions, his code specifies the namespace - the module name he saw in front.

Best practice says that...

  1. Every module starts with a package statement.
  2. Any module contains only one package.
  3. The module and package have the same name.

As the original e-mail implies, Perl does not enforce these rules. You must specifically implement them. On the plus side, the rules come from very smart people who have learned hard lessons over the years. Save yourself the confusion and aggravation.