Corrente

If you have "no place to go," come here!

"Issue loop"

Recently, Lord Eschaton introduced the term "issue loop", but without defining it. Here's an implementation that may express his idea:

// $Id: issue_loop.php,v 0.9 2011/06/29 12:37:00 lambert Exp $

/**
* @file
* A function to demonstrate an issue loop. Note especially
* the following semantic:
*
* echo() is not actually a function (it is
* a language construct).
*
* This code is released under the GNU General Public License.
*
* @todo Capture user email, follow through on stated issues that are not
* approved.
*
* @todo (Version 2) Treat issues as a self-referential linked list.
*
*/

/* Issue Loop function */

function issue_loop($issue) {
echo issue_loop($issue); // echo, indeed!
}

/* Create the list of approved issues (just examples, here) */

$approved_issues["To touch off a boom - and secure a prosperous future for all Americans - what's really needed are additional, sweeping rate cuts on both individual and corporate incom."] = TRUE;
$approved_issues["Government is not, and should not be, the main engine of job-creation in this country. That's the role of the private sector."] = TRUE;
$approved_issues["I consider marriage to be between a man and a woman."] = TRUE;
$approved_issues["It is apparent that our military is engaged in much more than enforcing a no-fly zone."] = TRUE;

/* Display list of approved issues. */

echo("\n" . "PLEASE FEEL COMPLETELY FREE TO COPY YOUR ISSUE FROM THIS LIST OF APPROVED ISSUES." . "\n\n");

foreach ($approved_issues as $issue => $truth) {
echo($issue . "\n\n");
}

/* Capture user input */
echo("Citizen, please state your issue:");

$handle = fopen ("php://stdin","r"); // NOTE: Works only from the shell;
$my_issue = trim(fgets($handle));

/* Only process approved issues. */
if (array_key_exists($my_issue, $approved_issues) !== TRUE) {
echo("\n\n" . "Please be more savvy and pragmatic, and make sure your issue appears on the list of approved issues." . "\n\n");
exit;
}

/* Call the function */
issue_loop($my_issue);

?>

Here is a typical session that demonstrates the use of the tool:


localhost:/Applications/XAMPP/htdocs/d6 admin$ php issue_loop.php

PLEASE FEEL COMPLETELY FREE TO COPY YOUR ISSUE FROM THIS LIST OF APPROVED ISSUES.

To touch off a boom - and secure a prosperous future for all Americans - what's really needed are additional, sweeping rate cuts on both individual and corporate incom.

Government is not, and should not be, the main engine of job-creation in this country. That's the role of the private sector.

I consider marriage to be between a man and a woman.

It is apparent that our military is engaged in much more than enforcing a no-fly zone.

Citizen, please state your issue:I consider marriage to be between a man and a woman.

Fatal error: Maximum function nesting level of '100' reached, aborting! in /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php on line 27

Call Stack:
0.0008 334828 1. {main}() 0.0008 334828 1. {main}() /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php:0
7.8617 344952 2. issue_loop('I consider marriage to be between a man and a woman.') /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php:55
7.8617 344952 3. issue_loop('I consider marriage to be between a man and a woman.') /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php:27
7.8617 344952 4. issue_loop('I consider marriage to be between a man and a woman.') /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php:27
7.8617 344952 5. issue_loop('I consider marriage to be between a man and a woman.') /Applications/XAMPP/xamppfiles/htdocs/d6/issue_loop.php:27...


As you can see, the issue loop repeats until the system crashes. Mission accomplished!

0
No votes yet

Comments

Cujo359's picture
Submitted by Cujo359 on

To truly mimic our political discourse, you need to re-define (or, as the kids say nowadays, overload) the error function so it says something like

"This issue cannot be resolved by our current political system"

or some such.

I mean, really, "Fatal error:" is so 1990s.

And why so few levels of recursion? Any of those issues should be able to generate months of repetitive and banal discourse. So, think big, and make sure you have plenty of stack space.

No, I have no idea what I just wrote. ;-)