A quine is a computer program which takes no input and produces a copy of its own source code as its only output.
Wikipedia.
How about a fun challenge?
The task is to write a quine in InterSystems ObjectScript. It can be a class, or a method, or a routine, or just a line to be executed in a terminal. You decide!
Here's some resources you might consider useful:
Hard mode: do not use source code access functions.
Here's my (extremely uninspired, I know) attempt:
Class User.Quine
{
/// do ##class(User.Quine).Test()
ClassMethod Test()
{
set sc = ##class(%Compiler.UDL.TextServices).GetTextAsString($namespace, $classname(), .str)
write str
}
}
It produces this output:
![](https://community.intersystems.com/sites/default/files/inline/images/images/image(2506).png)
How many different ways of producing a quine are there in ObjectScript?