Talk:Unnecessary

From Esolang
Jump to: navigation, search

"Every working program is the null program and a quine." Is this intended to be vacuously true (every purple banana is poisonous), as no program works, or is it supposed to imply that "working programs" (nonexistant files) output nothing? The given interpreter does produce output, and hence the latter isn't true. The former seems a bit counterintuitive given the rest of the page, but that could be the point :). --GregorR 21:48, 23 Aug 2005 (GMT)

If I remember correct my original version was "Every working program is a null quine." or something similiar, Graue has added modified that part. But anyways; the interpreter doesn't output any program stuff, it just reports what's happening, that is not because of the 'program file'.. ;) It's not necessary for a interpreter to report if the execution is completed, like mine does with "Program executed perfectly right!". The only report interpreter must do is the case when the program file is found; then it must report an error message and terminate. --User:Keymaker

Making Unecessary do something

On many operating systems, it's possible to recover the contents of a file after it's been deleted (as long as they haven't been overwritten). Might it not be a good idea for an Unnecessary interpreter to first check for this situation, and then do something based on the contents of the file before it was deleted? --User:ais523

No, that would make Unnecessary useful... Instead, we should make Unnecessary to check if file WAS deleted previously and give an error too. Only 100% new files allowed. --(this comment by Marcsances at 14:36, 25 November 2011 UTC; please sign your comments with ~~~~)
I see no reason why the language should be forbidden from being useful. It's about requiring nonexistent files as source. That has nothing to do with being useless. --ais523 11:26, 28 November 2011 (UTC)
Touché. --Marcsances 23:15, 13 December 2011 (UTC)

Interpreter (Windows XP command prompt)

@ECHO OFF
IF EXIST %1 (
  ECHO ERROR 1>&2
  EXIT /B 1
)

Do you think it works? --Zzo38 20:33, 28 June 2008 (UTC)

Cool, thanks! Works perfectly as far as I can see. --Keymaker 23:50, 28 June 2008 (UTC)

Implementation for web

Hey... you could do a web implementation that asks for a URL.

If the URL exists it gives Error 808: File found.

If it doesn't exist, just a nop.

--(this comment by Marcsances at 14:31, 25 November 2011 UTC; please sign your comments with ~~~~)

200 would be better. Phantom Hoover 16:17, 25 November 2011 (UTC)
Well, 200 is used for successful requests. It is not an error. Maybe 202... it is near 200...--Marcsances 23:14, 13 December 2011 (UTC)
202 is for Accepted, so that wouldn't work. 302 Found might work, except that most browsers implement it as 303 See Other. Really, code 418 is probably best. —Maharba 16:01, 14 December 2011 (UTC)
And what about 410, or 444...
Here I leave a source code for a JS implementation (I think it works): http://pastebin.com/tdp70esm
Notice that Unnecessary program must be on the same path as the page that implements it. To call the function, use fetchStatus("/UNNECESSARY PROGRAM GOES HERE.unn"); --Marcsances 17:15, 29 December 2011 (UTC)

Implementation in JavaScript

This is a (bit strange) implementation in JavaScript with Node.js:

require("fs").stat(process.argv[2],x=>x._)

The error message is also strange. But, it is error if the file is exist and not error if they don't exist. (The specification does not say what kind of error message to report, so it look like OK to me) --Zzo38 (talk) 21:04, 11 December 2017 (UTC)