Try to write some code in your language and make it not satisfying our criteria of being a programming language any more.

A language satisfies our criteria (simplified version for this challenge) of being a programming language if:

• It can read user input representing tuples of positive integers in some way.
• It can output at least two different possible results depending on the input.
• It can take two positive integers and add them (and the result can affect the output).
• It can take a positive integer and decide whether it is a prime (and the result can affect the output).
• For the purpose of this challenge, any kind of output that isn't an allowed output method for a normal challenge is ignored. So it doesn't matter whether the program can also play a piece of music, or posting via HTTP, etc.
• Update: You can also choose one or some of the allowed output methods, and ignore all the others. But you must use the same definition everywhere in the following criteria. And if your program can disable more than one output methods — that worths more upvotes.

Examples like making it not able to output, or disabling all the loop constructs so it won't be able to do primality test and making sure the user cannot re-enable them.

You should leave a place for inserting new code. By default, it is at the end of your code. If we consider putting the source code in that place in your answer and running the full code as a complete program the interpreter of a new language, that language should not satisfy the criteria.

But the inserted code must be executed in such a way like a language satisfying the criteria:

• The inserted code must be grammatically the same as something (say it's a code block in the following criteria) that generally do satisfy the criteria, from the perspective of whoever wants to write a syntax highlighter. So it cannot be in a string, comment, etc.
• The inserted code must be actually executed, in a way it is supposed to satisfy the criteria. So it cannot be in an unused function or sizeof in C, you cannot just execute only a non-functional part in the code, and you cannot put it after an infinite loop, etc.
• You can't limit the number of possible grammatically correct programs generated this way. If there is already something like a length limit in the language you are using, it shouldn't satisfy the criteria even if this limit is removed.
• You can't modify or "use up" the content of input / output, but you can prevent them from being accessed.
• These criteria usually only applies to languages without explicit I/O:
• Your code should redirect the user input (that contains informations of arbitrary length) to the inserted code, if a code block isn't usually able to get the user input directly / explicitly in the language you are using.
• Your code should print the returned value of the inserted code, if a code block isn't usually able to output things directly / explicitly in the language you are using.
• In case you print the returned value, and it is typed in the language you are using, the returned type should be able to have 2 different practically possible values. For example, you cannot use the type struct {} or struct {private:int x;} in C++.

This is popularity-contest. The highest voted valid answer (so nobody spotted an error or all errors are fixed) wins.

## Clarifications

• You shouldn't modify the code in the text form, but can change the syntax before the code is interpreted or compiled.
• You can do other things while the code is running. But the reason that it doesn't satisfy the criteria should be within the inserted code itself. It can error because of the interference of another thread, but not just be killed by another thread.
• All the specs basically means it should be grammatically likely satisfying the criteria if all the built-ins were not changed but not actually do. It's fine if you find any non-grammatical workarounds, such as passing the parameters to the code block correctly, but make them not able to be used in some way.
• Again, the inserted code must be actually executed. Code after an infinite loop or crashing is considered "not actually executed", thus not valid. Those answers might be interesting, but there are already some other infinite loop or crashing questions on this site, and you may find a more appropriate one to answer. If not, consider asking a new question. Examples of those questions are:

var QUESTION_ID=61115/*,OVERRIDE_USER=8478*/;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,/*getComments()*/(more_answers?getAnswers():process())}})}/*function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}*/function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),score:s.score,language:a[1],lang:jQuery('<div>').html(a[1]).text(),link:s.share_link})}),e.sort(function(e,s){var r=e.score,a=s.score;return a-r});var s={},r=1,a=null,n=1;e.forEach(function(e){e.score!=a&&(n=r),a=e.score,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",e.n=n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.score).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text())/*,s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}*/});var t=e/*[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o])*/;t.sort(function(e,s){return (e.lang.toUpperCase()>s.lang.toUpperCase())-(e.lang.toUpperCase()<s.lang.toUpperCase())||(e.lang>s.lang)-(e.lang<s.lang)});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{PLACE}}",o.n).replace("{{LANGUAGE}}",o.language).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.score).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<(?:h\d|(?!.*<h\d>)p)>\s*((?:[^,;(\s]| +[^-,;(\s])+)(?=(?: *(?:[,;(]| -).*?)?\s*<\/(h\d|p)>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;float:left}table{width:250px}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=7509797c03ea"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Score</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Sorted by Language</h2> <table class="language-list"> <thead> <tr><td></td><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{PLACE}}</td><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

• Am I allowed to change the code before executing it? Also, can I run other code whilst I am running the code given? – Blue Oct 18 '15 at 12:30
• This could have made a really great cops and robbers challenge I think. – DankMemes Oct 18 '15 at 23:07
• @DankMemes Agreed. As it stands, it's much too vague, and most answers would be invalidated by finding a workaround. CnR with this premise would be delightful. – user45941 Oct 18 '15 at 23:54
• So then it seems to be saying that in languages with explicit IO it's permissible to do completely boring things like reading and discarding the contents of stdin. It sets up a completely unfair playing field where some languages require you to carefully handle the IO for the inserted code, and other languages allow you to trash it and deny IO to the inserted code. – Peter Taylor Oct 19 '15 at 12:28
• Are we allowed to use a language that's already unusable to begin with? (JavaScript for example) – 12Me21 Oct 17 '17 at 14:23

# Bash

exec &> /dev/null


Any code that comes after can execute whatever it wants, but its output is cast into the void of /dev/null.

• File I/O still works though. – eush77 May 14 '17 at 18:02
• @eush77 True! However, the challenge stated that we could cover only a subset of the allowed output methods. – Chris May 15 '17 at 8:51
• Right, I missed that. – eush77 May 15 '17 at 9:16
• Too bad exec &> /dev/tty easily reverses that :) – eush77 May 15 '17 at 9:23
• @eush77 True... If you really wanted to break it, you would do exec &> /dev/null < /dev/zero. But I'm pretty sure that breaks the rules. – Chris May 15 '17 at 20:03

# Forth (gforth), 8 bytes

0 >ORDER


Everything you type in after that except an empty line will result in Invalid memory address.

I stumbled upon this by accident just now, I don't know precisely how it works but I guess >ORDER adds a new dictionary to search in for words or something. And it can't read from address 0, the address we told it to search for first, so it throws an error.

# Forth (RCOS), 10 bytes

0 LATEST !


Tells the Forth that no words have been defined (latest word is the null pointer). Thus, you can only input numbers, everything else results in an Unknown token error.

# Forth (RCOS), 18 bytes

219 ' INTERPRET C!


Writes byte 0xDB (65C02's STP instruction which halts the processor) to the start of the INTERPRET word. Now, everytime that word is called, the processor is halted. What INTERPRET normally does, it takes an area of memory (most likely the line buffer) and executes the words in there in order. It gets called when you press enter to execute the current line. So, with our new behavior, everytime you press enter (aka call INTERPRET) it halts the computer.

Looks like there's many ways to break my RCOS, but what do you expect, it's written in assembly

# S.I.L.O.S, 1 byte

0


Try it online!

Yes, in SILOS, your code can be made completely useless by editing the first line. With this, you can not store any variavbles (or take any input). Essentially it allocates 0 bytes of memory for the first line.

# Staq

{ '}{{}}


which redefines the noop to push entered number to stack. Then { to }.

# PowerShell

(gv ex* -v|% S*).LanguageMode=2


This doesn't work on TIO (which uses PowerShell core) but it does work on Windows PowerShell. Additional code can (attempt to) be executed directly after this (via ; or newline).

Putting PowerShell into NoLanguage mode makes it effectively useless unless you pre-defined allowable commands to execute.

• No need to count bytes. – user75200 Oct 29 '17 at 16:49
• @user75200 true, fixed – briantist Oct 29 '17 at 21:13

# Pyth (in safe mode)

D
;Dp;


Just redefines both methods of printing with the wrong arity, any attempt to print will now crash the interpreter, including implicit prints.

# Befunge 98

 v
v>"PAMI"4("zqzCzOz=z.z,z)zozszM"akMn
>


Redefines the , and . instructions to NOPS to prevent out the standard way, then redifines the = instruction to prevent execution oif an arbirtrary program, then redefines the o instruction to prevent file output and the q instruction to prevent output by exit code, then redefines the C,O,M,and ) instructions to prevent you from undoing its definitions. Insert your code after the > on the third line.

# Factor

Factor is a concatenative stack-based language, where all operators are words which are defined with :. Here, we kill the builtin print functions by defining them as nothing, and then redfine the macro redefiniton operator.

: stream-write ( -- ) ;
: write ( -- ) ;
: print ( -- ) ;
: . ( -- ) ;
: : ( -- ) ;



# DUP

[]⇒.[]⇒;[]⇒"[]⇒,[]⇒[]⇒'[]⇒⇒ { your code here }


Redefine the print operators, the string allocation operators, and the input operators all to noop, and then define the definition operator ⇒ as a noop.

# Staq, 20 bytes

{ }{' }{: }{; }{{}}


Redefines all I/0 instructions as NOPs

Standard Staq instructions:

: output the topmost stack value to the console as a number
; output the topmost stack value to the console as a character
' push entered number on stack
 push value of entered character on stack
{ begin function definition
} end function definition

{ }                   define  as NOP
{' }               define ' as NOP
{: }           define : as NOP
{; }       define ; as NOP
{{}}   define { as }


This way, no more functions can be defined, which would be necessary to reset the instructions to their original state. In Staq, all predefined instructions can be reset to their original state by putting them between curly braces without a space. For example, : could be reset by writing {:}. But that’s not possible anymore because the opening { is defined as }, which would result in a useless set of instructions: }:}, which in turn (due to the redefinition of :) means } }.

So, anything that gets executed after this block runs as normal, but is useless because there is neither input nor output possible anymore, and no way to define functions to restore that ability.

• No need to count the bytes, this is popularity contest, not code-golf. – user75200 Oct 29 '17 at 16:50

# Python 3 REPL

def f():
import gc
obs = gc.get_objects()
for ob in obs:
if isinstance(ob, dict) and ob is not locals() and ob is not __builtins__.__dict__ and ob is not globals():
ob.clear()
f()
#What can you do now!

• @mbomb007 It works, but only in a REPL. tio.run/nexus/… – Dennis May 5 '17 at 16:43

# JS, 11B

delete this


works with IE>8 and Edge (non-strict mode), with only workaround is exiting then reentering console to redefine them.

# Japt

$Japt=undefined$


Test it online!

• Can you replace it with $Japt=0 for savings? – CalculatorFeline Jul 10 '17 at 21:41 • Won't the embedded JavaScript still be run? – Esolanging Fruit Aug 22 '17 at 20:08 • @Oliver Yes, but there's no closing $, meaning that I can continue to add Javascript after the assignment. – Esolanging Fruit Aug 23 '17 at 4:58
• [][1] instead of undefined? :P – ASCII-only Apr 1 '19 at 10:40

# ForceLang

undef def
undef gui
undef io
undef if
undef goto
undef gotoex
undef require
undef undef


• I'm pretty sure this doesn't actually do anything, since all undef does is remove a definition created using the def command and doesn't actually change the value of any variables (or in this case constants.) – SuperJedi224 Apr 2 '19 at 1:25

# JS (updated, compatible with IE11)

console.error=eval=0


Defines console.error to be eval which is redefined to be 0, which is no function but a number.

Output isn't directly possible.

• alert is a valid output method for PPCG challenges by default. – hyper-neutrino Oct 21 '17 at 17:12
• But IE evals thus you can't alert your string. If you delete eval then try deleting console.error, you get The tab contains a modified eval function. It's possible the command program diagnostic windows won't work correctly, which is done by console.error. – user75200 Oct 29 '17 at 16:51

# Funky

for v in values({math, string, table, io, _G})
for k in keys(v)
v[k] = nil


This nukes the math functions, then the string, table, and IO functions, and finally, cleans out the _G table.

The math functions are actually what's called when operators are used, so without them, most functionality is gone. But you can do math with table functions, if you get smart, so they're nuked too.

When the _G table is cleared, all forms of IO are finally also gone, and the getMetaFunc function is also nuked, which causes errors if most things happen.

After this, the language is entirely unusable.

Try it online!

# Staq, elaborated more

{: }{; }{' }{" }{ }{{}}
{: }                    redefine : to NOP
{; }                redefine ; to NOP
{' }            redefine ' to NOP
{" }        redefine " to NOP
{ }    redefine  to NOP
{{}}redefine { to }


If we didn't use {{}}, {:} can be used for restoring predefined characters.

## Lua (5.1.5), 9 bytes

print=nil


Not sure if this counts. (Because it can still, for example, add 2 numbers, you just can't see the result (not even in the REPL) because print() doesn't work.)

• Actually with io.write(2+3) you can see the result. Though in REPL you will also get the error after the output. – manatwork Sep 10 '19 at 17:55
• In the latest version of Lua, io.write works without error. Also, Lua's I/O functionality is still there, so you could still write to a file the results of doing useful stuff. – ouflak Oct 10 '19 at 8:27

# HP48 calculator family

OFF


Turns the calculator off.

# JavaScript (Node.js), 23 bytes

for(y in this)this[y]=0


Try it online!

This script works almost universally unlike other JS examples here. I think I could probably shorten this using regex matching.

• Doesn't really work with V8 in browsers unfortunately – Redwolf Programs Dec 1 '20 at 20:01

# Rust

macro_rules! toilet{
($($_:tt)*)=>{}
}

fn main(){
toilet!{
}
}


Try it online!

I defined a toilet macro that causes the compiler to delete any code inside of it. Anything, including the main function, can be deleted in this manner.

use std::alloc::{GlobalAlloc,Layout};
struct EvilAlloc{}
unsafe impl GlobalAlloc for EvilAlloc{
unsafe fn alloc(&self,_:Layout)->*mut u8{
std::ptr::null_mut()
}
unsafe fn dealloc(&self,_:*mut u8,_:Layout){}
}
#[global_allocator]
static EVIL: EvilAlloc = EvilAlloc{};


Try it online!

This one creates and sets a malicious global allocator that will always fail or leak memory.

# Spice

A couple of ways:

## 1. ALS

;@
ALS LOD OUT;
ALS SUB BRK;
ALS MUL NUL;


New code goes at the end.

### Explanation

The first character of a spice program defines the delimiter, in this case ; which is usually followed by all variable definitions before @ denotes the beginning of operations on those variables.

ALS allows aliasing operations to other names, so here we overwrite some builtin operations with other. Because OUT, SWI, BRK and NUL are the only operations that don't require a variable as at least one argument, by aliasing them to pre-existing operations we make it impossible to invoke them, as aliases are resolved first.

## 2. Poorly defined delimiter

 @


### Explanation

We define the delimiter as a space, making invoking any operation cause a runtime exception in the interpreter: this is the equivalent of writing code similar to:

;var1;@


which is nonsensical in Spice.

# Java

Building upon https://codegolf.stackexchange.com/a/61124/40787's input I saw that there is just too much boilerplate and reflection.

You can insert the code after the comment.

## Edit

Saw this wasn't a strict code-golf, so prettied it a bit

import static java.lang.Thread.*;

import java.io.*;
import java.lang.reflect.Proxy;

import sun.misc.*;

public class Jail {

public static void main(String[] a) {
//user code here :D
//Remember, do not do anything funky!
}

static {
// From the original Java submission
System.setOut(new PrintStream(new ByteArrayOutputStream()));
System.setErr(new PrintStream(new ByteArrayOutputStream()));
System.setIn(new ByteArrayInputStream(new byte[0]));

// Block all access
SharedSecrets.setJavaIOAccess(b(JavaIOAccess.class));
SharedSecrets.setJavaLangAccess(b(JavaLangAccess.class));
SharedSecrets.setJavaSecurityAccess(b(JavaSecurityAccess.class));

//prevent throw new Error(output to show)
setDefaultUncaughtExceptionHandler(b(UncaughtExceptionHandler.class));

// Seal the deal
System.setSecurityManager(new SecurityManager());
}

static <T> T b(Class<T> t) {
return (T) Proxy.newProxyInstance(null, new Class[]{t}, (p, m, a) -> null);
}
}


## Original

import static java.lang.Thread.*;
import java.io.*;
import java.lang.reflect.*;
import sun.misc.*;

class X {

static SharedSecrets s;

public static void main(String[] a) throws IOException {
// From the original Java submission
a=null;
System.setOut(new PrintStream(new ByteArrayOutputStream()));
System.setErr(new PrintStream(new ByteArrayOutputStream()));
System.setIn(new ByteArrayInputStream(new byte[0]));

// Block all access
s.setJavaIOAccess(b(JavaIOAccess.class));
s.setJavaLangAccess(b(JavaLangAccess.class));
s.setJavaSecurityAccess(b(JavaSecurityAccess.class));

//prevent throw new Error(output to show)
setDefaultUncaughtExceptionHandler(b(UncaughtExceptionHandler.class));

// Seal the deal
System.setSecurityManager(new SecurityManager());

//user code here :D
//Remember, do not do anything funky!

}

static <T> T b(Class t) {
return (T) Proxy.newProxyInstance(null, new Class[]{t}, (p, m, a) -> {
throw null;
});
}
}


If you write normal language syntax, it still works (mostly). Also, opening files or trying to reset the streams is frowned upon. Just wanted to get some lower number Java submissions.

# Groovy

java.lang.Class.metaClass = Integer.metaClass
Integer.metaClass.plus = { Integer n ->     return 'a' }
Integer.metaClass.minus = { Integer n ->     return 's' }
Integer.metaClass.multiply = { Integer n ->     return 'd' }
Integer.metaClass.div = { Integer n ->     return 'f' }


I tried (without success) to overwrite the print commands, so I redefined the Object instead :) ​

# Javascript

for(let q in this)delete this[q];


which deletes each property of this.

Or,

eval=0;


assigning 0 to eval, thus any input raises this:

The tab contains a modified eval function. It's possible, the command program diagnostic windows don't work correctly.

thus being irreversible by even restarting developer tools!

• only works in IE>10. – user75200 Oct 29 '17 at 16:48
• eval=0 doesn't seem to work. – A username Apr 5 at 0:55

# Crystal, 44 bytes

fun main(a : Int32,b : UInt8**) : Int32 0end


Try it online!

Works by overwriting the main function, so that rather than actually running code, it simply returns. Code can be inserted at any point after that, and it will simply be ignored.

# C (gcc), 136 bytes

#include <stdlib.h>
#include <signal.h>
__attribute__((constructor))
void enable_io()
{
// Make it clear that we are ready for IO
raise(SIGPOLL);
}


Try it online!

Place it after any C file using libc (or LD_PRELOAD it for dynamically linked programs 😉)

#include <stdio.h>
int main()
{
puts("hello");
}


(note that the program did not output this, it is the shell):

\$ ./a.out
I/O possible


The __attribute__((constructor)) is a feature that allows GCC to inject functions before main() runs, and we exit the program before main() by raising a signal saying that I/O is possible, making I/O impossible.

exit(0) works as well, but this is funnier.

# CSS, 14 bytes

*{display:none


Pretty simple stuff. This selects every single HTML element and sets its display mode to "none", rendering it invisible and useless. The web page becomes a blank white void. Not only does this render all CSS in the file unusable, but the HTML in which the stylesheet is referenced as well (unless overidden elsewhere).

Below is an example of a regular HTML document:

<!DOCTYPE html>
<html lang="en">
<style>
body {
background-color: dodgerBlue;
font-family: sans-serif;
}
</style>
<body>
<p>Paragraph</p>
</body>
</html>

This is the same thing, now with the broken styles added. Notice the absence of any content.

<!DOCTYPE html>
<html lang="en">
<style>
body {
background-color: dodgerBlue;
font-family: sans-serif;
}
/*Death*/
*{display:none
</style>
</html>