Talk:Nil
The world's first Nihilistic programming language?
Correct me if I'm wrong, but wouldn't that be Sartre? --Rune 12:22, 3 Sep 2005 (GMT)
- I don't think so: Nil does exactly nothing, and Sartre does exactly something. --Ihope127 21:56, 14 Sep 2005 (GMT)
Nil or NIL?
The official page on the language is titled The NIL Programming Language, and the page on the site that links to it also calls it NIL, but the page itself refers to the language as Nil. So which do we use? Or should both be acceptable? --Safalra 13:37, 16 Oct 2005 (GMT)
- Hmmm, I think both should be acceptable. --User:Keymaker
The javascript page is wrong, newlines doesn't work
Idea for interpreters
Many people like making interpreters for esoteric languages, so I thought that there should be something saying that the Nil interpreter must take code and do something.
A Python implementation based on that:
def nil_interpreter(code): for i in range(code): if code[i-1:i]=="": print("Cheater!")
--Ender scythe (talk) 01:46, 22 November 2016 (UTC)
- I don't understand this implementation. The part
range(code)
suggests thatcode
is a number, but then you slice it, which doesn't make any sense. Orisphera (talk) 07:26, 18 July 2020 (UTC)
- I think he probablhy meant
for i in code
rather thanfor i in range(code)
. TwilightSparkle (talk) 01:36, 19 July 2020 (UTC)
- I think he probablhy meant
Dead link
There's an external resource, marked as an online Nil interpreter, which is also marked as a dead link.
My question is, despite being dead, does the link nonetheless still fit the definition of a Nil interpreter in its dead state? --ais523 20:13, 27 January 2018 (UTC)
Interpreter Exploit
While playing with Nope. I discovered a possible exploit with the Nil interpreter. Nil claims to do nothing, but the provided interpreter true
sets a success status on exit, so it is possible to detect whether at least one Nil program has been run on a system. Here is a Nil interpreter that patches this hole and leaves previous status codes unchanged:
alias nil="echo \"return \\\$((\$? + "\\\${PIPESTATUS[0]}" + test \\\$(rm -f /tmp/\$(date +%s%N|cut -c1-9)* )))\" > /tmp/\$(date +%s%N);. /tmp/\$(date +%s%N|cut -c1-9)*"
tests:
# Demonstrates the problem with true: false;true nil-program;if [ $? -ne 1 ]; then echo "Hey interpreter, you did something!"; fi >> Hey interpreter, you did something! # Shows the fix: $false;nil nil-program;if [ $? -ne 1 ]; then echo "Hey interpreter, you did something!"; fi # Other examples true; nil a-program; echo $? >> 0 false; nil a-program; nil a-program; nil a-program; nil a-program | nil a-program | nil a-program; echo "${PIPESTATUS[@]}" >> 1 source; nil a-program; echo $? >> bash: source: filename argument required >> source: usage: source filename [arguments] >> 2 not-findable; nil a-program; echo $? >> not-findable: command not found >> 127
This interpreter should have no effect on status codes for any number of runs or pipe combinations. A previous version gave non-deterministic results occasionally in long pipe chains.
The Nil spec doesn't make an issue of status codes, so maybe this is not required, but I believe this interpreter is truer to the spirit of a truly nihilistic language. Salpynx (talk) 00:50, 7 January 2019 (UTC)