Monday, August 24, 2009

Writing a quine

While reading through Wikipedia, I came across something called a quine, and here is its definition:

In computing, a quine is a computer program which produces a copy of its own source code as its only output.

I was inspired by this and decided to make a quine in X++, the programing language of Microsoft Dynamics AX.

static void quine(Args _args)
{
#AOT;
print TreeNode::findNode(strfmt(#JobPath,"quine")).AOTgetSource();
pause;
}
It’s a job that finds it’s own tree node in the AOT, gets the source of that node and prints it. I originally wrote it all on one line, because I like the look of that better, but I didn’t do that here for readability.

Now I’m not entirely sure if this qualifies as a quine, because a quine can have no input, and using the method AOTgetSource could be seen as cheating. But anyway, it reproduces itself, it’s short, and it made me happy

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...