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
• @muddyfish Basically no and yes. See the clarifications. – jimmy23013 Oct 18 '15 at 12:53
• 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. – Mego 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

## Hoon

=<  ~


Hoon is a odd. It's pretty much entirely unlike other programming languages, not only in syntax but in semantics. Unlike languages like Hexagony, though, it wasn't made to be purposely esoteric.

Hoon compiles to Nock, a minimal combinator based VM. Nock is stupid: the spec can be gzipped to 340 bytes. The only math operation is incrementing. Everything is a noun: an atom (bignum) or a cell (pair of nouns), with the entire memory model arranged in an immutable acyclic binary tree. The only output is the noun that your expression reduces to.

Because of the weird compilation target, Hoon is also weird: it's completely pure. Hoon compiles down to a Nock expression that is evaluated on a "context". The entire kernel and stdlib, along with all variables, are passed implicitly to the program by the context.

To make Hoon unusable we just use =<, which is "evaluate a in the context of b". We are always evaluating ~, which is zero. No matter what b does, it can't change the value it reduces to, and since it can't have side effect it can't do input or output.

Side note: Since you can't actually prompt for input from Hoon (purity!), by the rules it isn't actually a programming language. Input is via function arguments, output via return values (or ~&, which is more of a printf debugging feature and is transparent to the program).

For a program to get input in Urbit, you actually write a program that return a function that accepts input, and the shell asks on your behalf and passes to the callback.

• Definitely a programming language by our standards, though – cat Oct 1 '16 at 10:41

# Python 2, insanely big

import rexec, ihooks, types, os, struct,sys,imp
from functools import update_wrapper as do_update, wraps
__all__ = ["RExec","enable"]
trashed = False
from ctypes import pythonapi, POINTER, py_object
getdict = pythonapi._PyObject_GetDictPtr
getdict.restype = POINTER(py_object)
getdict.argtypes = [py_object]
modified = ctypes.pythonapi.PyType_Modified
modified.argtypes = [ctypes.py_object]
def dictionary_of(ob):
dptr = getdict(ob)
if dptr and dptr.contents:
return dptr.contents.value
RESTRICTED = "NOT AVAILABLE"
class RExec(rexec.RExec):
ok_sys_names = rexec.RExec.ok_sys_names + ("warnoptions","py3kwarning","flags")
nok_sys_strings = ("executable",)
ok_builtin_modules = rexec.RExec.ok_builtin_modules + ("cStringIO","exceptions","_collections","itertools","_hashlib","_codecs","_functools","_struct")
def __init__(self, hooks = None, verbose = 0):
ihooks._Verbose.__init__(self, verbose)
self.hooks = hooks or rexec.RHooks(verbose)
self.hooks.set_rexec(self)
self.modules = {}
self.ok_dynamic_modules = self.ok_builtin_modules
list = []
for mname in self.ok_builtin_modules:
if mname in sys.builtin_module_names:
list.append(mname)
self.ok_builtin_modules = tuple(list)
self.set_trusted_path()
self.make_builtin()
self.make_initial_modules()
self.make_sys()
self.make_StringIO()
def make_sys(self):
old_rexec.make_sys(self)
sys_ = self.modules["sys"]
for name in dir(sys):
obj = getattr(sys,name)
if "__" not in name and type(obj) == str and \
not hasattr(sys_,name):
if name in self.nok_sys_strings:
obj = RESTRICTED
setattr(sys_,name,obj)
sys_.argv = [RESTRICTED]
def make_initial_modules(self):
old_rexec.make_initial_modules(self)
self.copy_except(types,["__builtins__"])
self.copy_except(os.path,["__builtins__"])
b = self.modules["__builtin__"]
for module in self.modules.itervalues():
module.__builtins__ = b
def make_StringIO(self):
t = type(self.r_open)
if t == types.ClassType or t == type:
return
elif t != types.FunctionType and t != types.MethodType:
raise RuntimeError
io = self.r_import("StringIO").StringIO
old_open = self.r_open
class r_open(io):
def __init__(self,*openargs):
o = old_open(*openargs)
if o.isatty():raise IOError
def __enter__(self):
return self
def __exit__(self,type,val,tb):
self.close()
for name in "truncate write flush".split():
exec "def %s(self,arg=None):raise IOError('File not open for writing')" % name
del name
ntypes = self.modules["types"]
b = self.modules["__builtin__"]
ntypes.FileType = self.r_open = b.open = b.file = r_open
def r_import(self,name,globals={},locals={},fromlist=[],level=-1):
redone = name in self.modules
found = False
try:
result = self.importer.import_module(name, globals, locals, fromlist,level)
except ImportError:
if name == "imp":
result = imp.new_module("imp")
self.modules["imp"]=result
found = True
if redone:pass #Only do this once
elif name == "sysconfig":
result._PROJECT_BASE = "x"
result._CONFIG_VARS = {}
elif name == "functools":
update = result.update_wrapper
def update_wrapper(wrapper,wrapped,assigned=(),updated=()):
return update(wrapper,wrapped,assigned,updated)
do_update(update_wrapper,update)
result.update_wrapper = update_wrapper
def wraps(wrapped,*args,**kw):
return result.partial(update_wrapper,wrapped=wrapped,*args,**kw)
do_update(wraps,result.wraps)
result.wraps = wraps
return result
def s_apply(self,func,args=(),kw=None):
kw = kw or {}
if getattr(func,"__stdin_trashing",False):
kw["s_applied"] = True
return old_rexec.s_apply(self,func,args,kw)
r_exc_info = staticmethod(sys.exc_info)
def r_method(name):
l = {}
exec \
"""def %s(self,*args,**kwargs):
s_applied = kwargs.pop("s_applied",False)
if kwargs:raise TypeError
if not s_applied:
self.save_files()
sys.stdin = sys.stdout = sys.stderr = None
global restrictedly
restrictedly = True
try:
return old_rexec.%s(self,*args)
finally:
restrictedly = False
if not s_applied:
self.restore_files()
setattr(%s,"__stdin_trashing",True)""" % (name,name,name) in globals(),l
return l[name]
r_exec = r_method("r_exec")
r_eval = r_method("r_eval")
del r_method
old_rexec = rexec.RExec
class ModuleImporter(ihooks.ModuleImporter):
def determine_parent(self, globals, level=-1):
if not globals or not level:return None
pkgname = globals.get('__package__')
if pkgname is not None:
if not pkgname and level > 0:raise ValueError, 'Attempted relative import in non-package'
else:
modname = globals.get('__name__')
if modname is None:return None
if "__path__" in globals:pkgname = modname
else:
# normal module, work out package name if any
if '.' not in modname:
if level > 0:raise ValueError, ('Attempted relative import in non-package')
globals['__package__'] = None
return None
pkgname = modname.rpartition('.')[0]
globals['__package__'] = pkgname
if level > 0:
dot = len(pkgname)
for x in range(level, 1, -1):
try:
dot = pkgname.rindex('.', 0, dot)
except ValueError:raise ValueError('attempted relative import beyond top-level package')
pkgname = pkgname[:dot]
try:
return self.modules[pkgname]
except KeyError:
if level < 1:
"absolute import" % pkgname, RuntimeWarning, 1)
return None
else:raise SystemError, ("Parent module '%s' not loaded, cannot perform relative import" % pkgname)
restrictedly = False
def enable():
rexec.RExec = RExec
rexec.RModuleImporter = ModuleImporter
global trashed
if not trashed:
subclasses = type.__subclasses__
error = None
def restrict(fun):
error_ = error
def censored(*args):
global restrictedly
if restrictedly:
if error_ is not None:
return error_
raise RuntimeError
return fun(*args)
return censored
error = ()
dictionary_of(type)["__subclasses__"]=restrict(subclasses)
error = None
modified(type)
#Stop uses of frames (created using with statements)
old_frame = types.TracebackType.tb_frame
@property
@restrict
def new_frame(self):
return old_frame.__get__(self,types.TracebackType)
@new_frame.setter
def new_frame(self,v):
dictionary_of(types.TracebackType)["tb_frame"] = new_frame
modified(types.TracebackType)
trashed = True
def test():
enable()
r = RExec()
try:
r.r_exec(
)
finally:
return 0
if __name__ == "__main__":
enable()
test()
sys.exit()


This insanely large amount of code is a revival of the ancient rexec module (abandoned in python 2.3) with a bunch of new modules added to the "ok" list and a bunch of weaknesses fixed (including the object.__subclasses__() method that has made at least two other python answers invalid).

Quite a bit of this code (the __init__ method of the RExec class and the entire ModuleImporter class) is copied from the python standard library with small modifications.

• 0.o wh...what have you done – cat Feb 22 '16 at 20:45
• 8064 bytes by the way – cat Feb 22 '16 at 20:45
• @cat not that this is code golf. I could probably golf out at least 1000 bytes. – pppery Feb 22 '16 at 20:46
• of course, but you said "insanely big" so i thought i'd note it – cat Feb 22 '16 at 20:49

## GolfScript

"#{def eval(s) end}":+:%:/:,:*:do:while:until


The series of :foo replaces all of the looping operators and addition and concatenation, but that's not sufficient. It's also necessary to prevent deferring the computation to Ruby's string interpolation, which I accomplish by replacing Ruby's eval operator using a string interpolation. String literals which occur later in the source code will be passed through my no-op eval rather than the built-in one.

The reason it's necessary to replace all of the looping operators, even such innocuous ones as ,, is that primality testing doesn't require unbounded looping. E.g. the following uses only , in its three forms (range, filter, len) to do primality testing:

~.,2>{1$\%!},,\;  The reason for replacing + is that jimmy23013 proposed using quining to get a looping construct. The specific implementation he provided doesn't work because by clobbering foo I've also clobbered the (standard) interpreter's way of parsing strings, but I expect it could be reworked using blocks instead of strings so I'm playing it safe. • Primality test is still possible: ~.1>2\'3$3$\'@2$-@@2$0>!.+.+.+.+.+.+>.~\'.~;;!!@&@)\@3$3$>.+.+.+.+.+.+.+>.~'.~;\;\;. Without eval strings and numbers can't be specified directly, but there are workarounds like n[n!!.+.+.+.+.+.+]+. – jimmy23013 Oct 22 '15 at 12:01 • Seems to give an error in the online tester; I'll try it at home later. Is the idea basically to use a quine technique to get a loop? – Peter Taylor Oct 22 '15 at 12:37 • Yes. It doesn't work with "#{def eval(s) end}" directly and need some more complex workaround, which I'm not bothered to implement yet. – jimmy23013 Oct 22 '15 at 14:51 • Why not just block ~? Those .+.+... can be replaced with 1000 0 if. – jimmy23013 Oct 25 '15 at 14:37 • Or [.\;0 0 0 0 0 0 0 0]2base for example. – jimmy23013 Oct 25 '15 at 14:40 # Ruby 2.2.3 protected_methods = [:instance_methods,:__send__,:remove_method,:include?,:==,:to_s,:call,:pop] protected_constants = [ObjectSpace, NameError, Exception, Module] END{exit(0)} ObjectSpace.each_object(Module) do |mod| next if protected_constants.include?(mod) im = mod.instance_methods while (meth = im.pop) next if protected_methods.include? meth mod.__send__(:remove_method,meth) rescue NameError end singleton = (class << mod;self;end) singleton_im = singleton.instance_methods while (meth = singleton_im.pop) next if protected_methods.include? meth singleton.__send__(:remove_method,meth) rescue NameError end end s = (class << self;self;end) ms = s.instance_methods while (m = ms.pop) next if protected_methods.include? m s.__send__(:remove_method,m) end # Your code goes here  Ah, I love ruby. This code iterates through every Model (including classes) and un-defines all the methods, except for the ones in protected_methods. Anything you try to call is undefined, including Object#method_missing which means, due to a ruby quirk, a stackoverflow (technically stack level too deep) error is thrown. Fun fact: if Exception is not in protected_constants then ruby 2.2.3 segfaults (maybe I should submit a bug report about that /s). This was surprisingly bigger than I was first expecting, particularly because many things can't be DRY, because that would involve using methods that I need to be undefined. I am pretty sure this works. I've taken a multi-layered approach in that even if you manage to get something in, you probably won't be able to do anything to it; 5+4 results in undefined method '+' for 5:Fixnum, and good luck getting anything out. In case anyone needs to debug this, or if I forget, you can output after undefining IO#write if you grab a reference to it beforehand: debug = STDOUT.method(:write) class IO;remove_method :write;end debug.call('foo bar')  # Java I decided to do something little bit nasty and break java, by using little bit less code than here  public class a { static { final SecurityManager securityManager = new SecurityManager() { @Override public void checkPackageAccess(String pkg) { throw new RuntimeException("broken"); } }; System.setSecurityManager(securityManager); } public static void main(String[] args) throws Exception { //and here goes your code... } }  # Z80 assembler Two bytes are enough to completely hang any Z80 based system: di halt  aka "Disable interrupts, then halt until an interrupt arrives". Yeah, sure! EDIT: I had missed the "code that crashes doesn't count" part in the question, so I guess that this does not qualify. # Javascript Tested in Chrome. Object.defineProperty(document,"body",{get:function(){return null}}); Object.defineProperty(document,"innerHTML",{set:function(){}}); Object.defineProperty(HTMLElement.prototype,"innerHTML",{set:function(){}}); Object.defineProperty(HTMLElement.prototype,"innerText",{set:function(){}}); HTMLElement.prototype.appendChild=document.createElement=document.getElementsByName=document.getElementsByClassName=document.getElementsByTagName=document.getElementsByTagNameNS=document.getElementById=document.write=document.writeln=console=document.querySelector=document.querySelectorAll=alert=setTimeout=prompt=confirm=open=Array=Array.prototype.constructor=Object=Object.prototype.constructor=Object.prototype.toString=null; try{var window = {}; with(window){/*code*/} }catch(e){}  Browser javascript is really hard to break. • document.body.innerHTML="<iframe src=\"javascript:'<script>alert(prompt(\\\'Hello!\\\',\\\'\\\'));</script>'\">" – user2428118 Oct 20 '15 at 23:22 • @user2428118: Fixed! – SuperJedi224 Oct 21 '15 at 1:36 • Is it intentional that this immeadetly redirects the browser's location to 'null'? – pppery Oct 21 '15 at 20:28 • No, it isn't. Let me fix that. – SuperJedi224 Oct 21 '15 at 20:30 • setTimeout('throw "Test"',10) works for output too. Also window.open('data:text/html,a%20div'). – Ismael Miguel Dec 6 '15 at 22:06 # Javascript You can stop any output destroying (most of) the window object. Also, you can't get rid of document, but you can crush it's content every millisecond. Here's what I came up with: (function(window){ var html = document.getElementsByTagName('html')[0]; setInterval(function(){html.innerHTML='';}, 1); window.addEventListener('error', function(){}); for(var k in window) { if(k!='location') { window[k]=window; } } })(Function('return this')());  This sets every single object inside window (except location, it will reload the page) to be ... the window object!!! This will mess directly with the real window: Running Function('return this')() will return the this object for that context. Since that is eval'ed code, it will be the ... window object! This also catches all exceptions by setting an handler on window, before deleting everything. Also, we go grab the <html> element and set it's innerHTML to an empty string. This means that your output will work for less than a millisecond. Your code is still executed. It just won't be able to show any output. Maybe you can create a file! If only the API wasn't destroyed... Warning: This causes huge strain on your CPU and RAM. Run this at your own risk! It may cause overheating on your CPU and abnormal behaviour on your browser. It forces the code to run as many times as the browser can handle, in a second. This may cause a huge queue of functions to be executed, if it takes longer than the minimum time interval (which is 4ms for Firefox and Google Chrome (source provided by @somebody)) To stop the process, either run document.location=document.location or press F5. I am NOT responsible for ANY hardware or software damage or data loss caused by running this code. • Most browsers don't support intervals less than about 10ms. – SuperJedi224 Dec 6 '15 at 12:48 • @SuperJedi224 What browsers? It works everywhere where I try it – Ismael Miguel Dec 6 '15 at 14:24 • I heard somewhere that there was a minimum of 10ms in chrome and 15ms in FF and safari. Apparently, this is no longer the case. However, there is still a minimum of 4ms with nested timeouts and 1s in tabs that are not currently focused. – SuperJedi224 Dec 6 '15 at 18:43 • @SuperJedi224 But there aren't nested timeout. They seem to work fine on any browser I throw this at. If this worked only on a single version of a very specific browser, it was acceptable. Watch the most voted answer: it only works on a specific engine, in a specific version. – Ismael Miguel Dec 6 '15 at 19:11 • What I meant is that the information on which I had based my first comment was apparently outdated. – SuperJedi224 Dec 6 '15 at 19:15 # IBM Mainframe Assembler - 6 la 15,0  On entry to any program, Register 15 contains your base address. Overwrite that value, and expect an 0C4 abend (addressing exception) almost immediately. • Welcome to the site! – DJMcMayhem May 5 '17 at 20:58 • That appears to be 7 bytes. – CalculatorFeline Jul 10 '17 at 22:00 # Operation Flashpoint scripting language A feature I once discovered accidentally: You can create a variable with a name that's already taken by a command, thus making the command inaccessible. It can be recovered from by deleting the variable, but the command that is used to remove a variable can also be overwritten. Save the following as init.sqs in the mission folder: ; Overwrite commands that can be used to execute code with variables with the same name. call = 0 exec = 0 drop = 0 addEventHandler = 0 createDialog = 0 ; There are other commands that could do the task, but not without input from the player. ; Any command in the game can be overwritten (except operators whose name doesn't begin ; with a letter, those are not valid variable names), so to be completely sure one could ; overwrite every single command, but these should suffice. ; Even if somehow ("onFlare.sqs", "onPlayerKilled.sqs" or some other scripts that are called ; automatically under specific circumstances) one gets a script running, make it impossible ; to create loops. Recursion is only possible with 'exec' or 'call' (and technically with 'drop'). goto = 0 while = 0 forEach = 0 ; Overwrite the 'nil' command so that it cannot be used to recover from the above. ; Without this, "call = nil" would make 'call' work again (or any other overwritten command). nil = 0 ; Your code can be added here at the end of this script or anywhere else in the mission.  Now there is no way to use any kinds of loops or recursion. Trying to call a piece of code outputting "Hello, World!": # Taxi, 2354 bytes. This little program simply runs the taxi in a large joyride through Townsburg, running out of gas. Any code you run after this will quickly error with error: out of gas. And even if you could reach a gas station, which I don't think is possible, you couldn't get any gas, as no money has been collected, since there are no passengers. Go to Trunkers: west, 1st right, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st right, 1st left, 3rd left, 2nd left, 3rd left, 2nd right, 1st right, 2nd right, 1st right, 1st left, 1st left, 1st left, 1st right.  # StackStream { new-stream } 'stdinout def { drop exec } 'if def { drop drop exec } 'elseif def  Basically, this redefines the default symbol 'stdinout' to return an empty stream, which points nowhere. It then defines 'if' and 'elseif' to always run the first branch, so output is always the same. ## TeX (LaTeX) \output{\setbox1\vbox{\unvbox255}}} \let\output\relax  You can still do a lot in a code that starts with this. However, no pages will be ever produced. The output routine that takes care of building up the pages is destroyed, and also its "handle" is destroyed so that you cannot rebuild it. Needless to say, you can still compute a lot of stuff and output them in a file or in the log; you just can't use this crippled TeX to produce any document. To disable writes, you can simply add: \let\write\relax  You can't disable the log though. ## Forth 0 set-order  Basically, tell the interpreter/compiler that there are no dictionaries of known instructions. It can still read numbers (because they're not instructions) and they'll go on the stack if interpreting, but you can not issue any instructions about what to do with them, nor can you restore the search order because that would require issuing an instruction. # Enema :OQ::!Q:  Code can come any place after this. This language is similar to Emmental in that it is capable of redefining itself. Essentially, what we're doing here is redefining O (which normally is for output) to do nothing (thus making the language no longer have a transformational model) and then redefine ! (which can be used to reset a word to its default behavior) to do nothing as well. # Perl Not only will this make perl unusable, but your entire machine will seize up in seconds... Also works well for bash. while(fork){fork}  Because fork returns the PID of the child process, or zero for the parent, evaluation the first-fork will create two processes. One of those will exit the loop, and continue evaluation. The other will enter the while body, and create one additional new process with the second-fork. These two processes will again hit the first-fork and create and additional two processes, for a total of four. Two of those will exit the while loop, and execute following code a second and third time. The other two will again enter the loop body. Then four processes will be tested in the first-fork, creating 8 processes, four of which execute the following code for a 4th, 5th, 6th and 7th time. And so on. On any unix system, you run out of PID numbers and the fork begins to fail when you have 32k processes, but at this point, the scheduler is so busy that any interaction with a windowing system or shell is unusably slow. • Is the code after that actually executed? – jimmy23013 Dec 1 '15 at 8:10 • @jimmy23013 good question. The answer is yes; I updated my response to reflect this. – Dale Johnson Dec 1 '15 at 21:10 • In all fairness, Perl is unusable out of the box. – Mego Dec 1 '15 at 21:14 • What if your code includes kill(getppid())? – pppery Jun 18 '16 at 12:03 # Go I did it! I really finally did it! I've been stewing on this problem for months but I finally have a definitive solution that I challenge anyone to crack! package main import ( . "runtime" . "os" ) func main() { const ( Chmod = iota Chtimes Create Exit File FindProcess Lchown Link Mkdir MkdirAll NewFile Open OpenFile Process Remove RemoveAll Rename Setenv StartProcess Symlink TempDir Truncate Unsetenv ) Stdout.Close() Stdin.Close() Stderr.Close() defer func() { go func() { // User code here }() }() Goexit() }  My definitive reddit post on this problem for Go. But now, I have a solution. By forcing the user's code to execute in a goroutine, and then terminating the main goroutine with runtime.Goexit, the user can no longer set the exit code. If they panic the program crashes, yes, but if they don't then it also crashes, per the documentation of Goexit: Calling Goexit from the main goroutine terminates that goroutine without func main returning. Since func main has not returned, the program continues execution of other goroutines. If all other goroutines exit, the program crashes. • I give up, omfg – cat Oct 1 '16 at 10:46 • @cat Nonverbal communication can be hard to understand at times. Are you impressed, or annoyed that I have continued to notify you about my progress on this challenge? – EMBLEM Oct 19 '16 at 20:26 • I'm genuinely sorry, I guess I should have appended a :D -- I'm impressed, and only cheerfully annoyed at your awesome answer c: I don't mind you keeping me updated. – cat Oct 19 '16 at 21:47 # C #define main \ hide(); \ int main() \ { \ fclose(stdin); \ fclose(stdout); \ fclose(stderr); \ return hide(); \ } \ int hide  • Isn't "a function that is never called" against the rules? – Fabian Schmengler Oct 18 '15 at 19:53 • I see how I misunderstood "the inserted code", I have changed my answer to something that is hopefully valid. – user46060 Oct 18 '15 at 20:08 • That's recoverable. On Linux, freopen("/dev/tty", "r", stdin); freopen("/dev/tty", "w", stdout) should put you back on track. – PSkocik Oct 19 '15 at 23:16 • #undef main.. – R.. Oct 20 '15 at 2:52 • Why not just do void fclose(_) {...} and write your code in there? – Esolanging Fruit May 12 '17 at 4:48 # Simplex v.0.5 h]$g$o$s$$$u1{vbR4Rl<?[{;L}#]{p}u} h] ~~ define macro 0 as nothing$                            ~~ grab next character and redefine its function to
~~ evaluate the current macro number (0)
g o s  $~~ redefine output as a string (g), output as number ~~ (o), as a character (s), or as a result of ~~ suppression () and also prevents the user from ~~ redefining them back, if possible u1 ~~ goes up a strip and sets the byte to 1 { } ~~ repeat inside until a zero byte is met v ~~ goes down a strip b ~~ takes input as a string and puts to strip R4Rl< ~~ right, 4, right, length => length < 4 ?[ ] ~~ perform inside iff byte is not zero { } ~~ loop inside until zero byte is met ;L ~~ pushes the character to the outer program, left # ~~ stops evaluation (goes to outer program) { } ~~ loop inside until zero byte is met p ~~ removes current byte u ~~ goes up a strip to meet the 1 byte; essentially ~~ a while(true){...} loop.  Essentially, destroys the output commands, then takes input from the user as strings, pushing them to the outer program, until a null-length string is encountered, at which point evaluation ceases and the user's input (the outer program) is evaluated. The user cannot output anything nor can they redefine anything. This thus eliminates the criteria of being able to output anything. If you want to eliminate input, simply put a $ in front of each of G, b, and i before the octothorpe (#) 6 characters before the end.

# C++

int _=*(int*)0;


It looks like regular C, but C doesn't allow this because the right-hand side is not a constant. C++ will actually turn this into code that is run at run time to initialize the global variable _. If crashing is not allowed, then perhaps exiting cleanly is? AShelly's code can be written shorter:

#include<cstdlib>
int _=(exit(0),0);

• Invalid because the code after that wasn't actually executed. – jimmy23013 Oct 20 '15 at 14:04
• Hm, that makes several other aswers also invalid. Does the inserted code have to be executed (completely or not) without any compile time and run time errors? – G. Sliepen Oct 20 '15 at 14:56
• It just need to be executed. Run time errors doesn't matter. But compile errors would make it not able to be executed. – jimmy23013 Oct 20 '15 at 16:42
• The answers I gave would still compile without errors. Of course, the main() function itself doesn't get executed. You can #ifdef away most things in C; take #define if(x) if((x),0) for example, but can you say the if statement is still executed? The compiler will have optimized it away. – G. Sliepen Oct 20 '15 at 19:16
• User5254's answer can be ported to C++ then, without the #defines: int _=(close(0),close(1),close(2)); – G. Sliepen Oct 20 '15 at 19:17

# O

N:+:-:/:*:@:\:[:]:1:2:3:4:5:6:7:8:9:0:{:}:<:>:=:#:%:^:?:d:w:o:p::;


This reassigns mostly everything to a null codeblock, making any code that contains these characters do nothing.

You could add every ASCII character to make sure they can't do anything, but this kills all arithmetic, stack manipulation, codeblock creation, array creation, pushing numbers to the stack, comparing numbers, control flow, outputting, and assigning variables.

# Mouse-2002

$~your code here  In Mouse, $ denotes the end of the program, thus, anything after it will be evaluated and "run" but won't actually do anything. No online interpreter available, unfortunately, but here is a fixed-so-it-compiles-in-gcc version of the interpreter written in C.

• Too bad it ain't ): – cat Dec 9 '15 at 1:22
• Invalid because the code after it wasn't actually executed. – pppery Feb 22 '16 at 21:19
• @ppperry did you read past the first clause of the first sentence? – cat Feb 22 '16 at 21:22

# Mathematica

$Pre=Null&;  In Mathematica, $Pre will be applied to expressions before their evaluations.

For example,

$Pre=Null&; 1+1  Before 1+1 is calculated, it is wrapped by $Pre and becomes Null&[1+1]. 1+1 is then calculated to 2, but Null&[2] yields Null, which finally becomes the output. Simply Null as a output will defer the front-end from displaying it, thus nothing will be shown.

Moreover, one can never get access to 2 since it is considered as a intermediate result.

It can be proven that the calculation of the input does happen by

$Pre=.;  This resets $Pre, and everything is normal again.

• Um, why can't the user code include \$Pre=.;? – pppery Mar 3 '16 at 19:44
• I'd say Print. – CalculatorFeline May 5 '16 at 15:16
• I think Return works too, but I'm not sure. – Pavel Jan 16 '17 at 1:37
• It seems that your answer is invalid, as you state that one can break free. – Jonathan Frech Sep 18 '18 at 15:11

# Go (cracked by @EMBLEM)

I think this works. Imports can only be done immediately after the package declaration, and this is all the non-keyword builtins I can think to erase.

package main

func main() {
const (
int         = 0
print       = 0
rune        = 0
uint        = 0
uint32      = 0
float32     = 0
float64     = 0
byte        = 0
string      = 0
int64       = 0
println     = 0
panic       = 0
len         = 0
new         = 0
make        = 0
real        = 0
bool        = 0
complex64   = 0
complex128  = 0
delete      = 0
error       = 0
int16       = 0
complex     = 0
append      = 0
slice       = 0
close       = 0
imag        = 0
Type        = 0
Type1       = 0
copy        = 0
recover     = 0
ComplexType = 0
FloatType   = 0
IntegerType = 0
uint16      = 0
uint8       = 0
uintptr     = 0
int8        = 0
true        = 0
false       = 0
iota        = -5835906834593875673894720584705283473593027810815048571908567019158679843674576937045698634596396876895756897859678056987857850967597675
nil         = 0
cap         = 0
)

}

• I broke out of the prison! I can output nothing for primes and panic for non-primes. This satisfies the criteria of the site, but not for this challenge (because I still can't read user input). But you can prevent even that by adding defer func() { _ = recover() }() at the beginning. – EMBLEM May 22 '16 at 23:34
• @EMBLEM Oh my god. You win. – cat May 23 '16 at 0:14
• Don't forget to add my solution to my crack to your answer. But I'm not done yet! That deferred function prevents main from panicking, but not other goroutines. So I can just wrap all that in a go statement and block main on a nil channel communication. Presto, I'm free again! Deadlocks on primes, panics on non-primes. I can't think of a way to seal this, so your move. – EMBLEM May 23 '16 at 1:21
• IT IS DONE. FOR REAL THIS TIME. codegolf.stackexchange.com/a/95061/14091 – EMBLEM Oct 1 '16 at 2:05
• Since this answer is cracked, it is no longer valid and should therefore be removed. – Jonathan Frech Sep 18 '18 at 15:08

# J, online interpreter

f =: f
f 3


This calls f with f with f with... etc. Here's what the page looks like:

Successive attempts at entering things in yields, well, nothing:

Tested on Firefox.

• Hmm this only seem to break for me on the online interpreter using Firefox. The interpreter seems to be usable afterwards in Chrome, and jconsole handles the error completely differently locally. Might be worth noting. – Sp3000 May 23 '16 at 8:05
• @Sp3000 Huh, interesting. Consider it noted. – Conor O'Brien May 23 '16 at 15:51

# INTERCAL-72

DO ABSTAIN FROM NEXTING+REINSTATING


INTERCAL has a command for globally disabling the ability of other types of commands to run. (Using it in this form is generally considered a bad idea, because it's a global action-at-a-distance which has no way to exactly reverse it; more recent versions of INTERCAL also have ABSTAIN #1 FROM which is exactly reversed by REINSTATE, but that wasn't around in the time of INTERCAL-72, the oldest version of the language.)

ABSTAINING from REINSTATING is an even worse idea, because it then becomes impossible to even approximately reverse the effect of the ABSTAIN; you can't do a global REINSTATE (the crudest way to get the commands working again) if you can't do any sort of REINSTATE. All we have to do, therefore, is to disable enough other commands at the same time that the language becomes impossible to program in. INTERCAL-72 only has one useful control structure (NEXT/RESUME/FORGET), and disabling NEXT by itself is enough to make it impossible to do any sort of loop.

In more modern versions of INTERCAL, there are a ton of other ways to do control flow (COME FROM, WHILE (not the same as C's while!), TRY AGAIN, GO AHEAD, etc.), and even other ways to reinstate lines of code (e.g. AGAIN), so an answer in modern INTERCAL, while it could use the same general idea, would be a lot longer.

# 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

## Python 2

import sys
sys.setrecursionlimit(1)


Sets the maximum recursion depth to 1.
After entering these 2 lines, any subsequent line will yield:

RuntimeError: <exception str() failed>


Edit: They fixed this bug in Python 3.

## Python 3

import sys,os,_thread

def poll(id):
while True:
sys.stdout = None
sys.__stdout__ = None
sys.stderr = None
sys.__stderr__ = None
open = None
os.system = None
builtins = None



Print will now output nothing. Any other command that creates output gives:

RuntimeError: lost sys.stdout


Edit: The sys.__stdout__ = None serves to prevent the user from recovering sys.stdout using sys.stdout = sys.__stdout__. Credit to @someone.

Edit: sys.stdout could also be redirected to a file using sys.stdout = open("output.txt","w"). The open = None prevents this. Credit to @someone.

Edit: Added os.system = None because it could also be used to print. Credit to @Jonathan Frech

def print(x):
os.system("echo {0}".format(x))


Edit: open can be recovered by:

import builtins
open = builtins.open


Edit: Added builtins = None to disable builtins.open. Credit to @Jonathan Frech

• Can sys.stdout = sys.__stdout__ recover python 3 version? – someone Oct 22 '17 at 6:10
• @someone Indeed. Setting it to None as well seems to do the trick :) – Zachary Cotton Oct 22 '17 at 6:17
• Can we output to a file with sys.stdout = open("abc.txt","w")? – someone Oct 22 '17 at 6:24
• Outputting text is most likely still possible using os.system. – Jonathan Frech Oct 22 '17 at 19:44
• I think your last edit should say sys.stdout instead of sys.stdin. – Jonathan Frech Oct 23 '17 at 0:29

# Mascarpone

0^


Mascarpone is a language that is quite similar in concept to Emmental, but taken to the extreme. Interpreters are first class objects, so you can push interpreters to the stack, modify them, and then use them on program strings.

In this case, the initial interpreter assigns 0 the meaning of "push to the stack an interpreter in which every character is defined to cause an error." ^ is assigned the meaning of "pop an interpreter off the stack and assign it as the new interpreter for subsequent characters in the program." This means that any characters added after this will error.

Alternatively, if this violates the "code must actually execute" rule, there are many other ways to break the language.

v'_>1^


This is similar, but instead of defining every character to be an error, it defines every character to be a no-op. That way, every character of your code is technically executed, but it just has no effect.

Here's another way:

v'_v>'x<^


x should be replaced with a command here. This essentially creates a new version of the current interpreter with x redefined to be a no-op, and then assigns that as the new interpreter.

While disabling commands might seem devastating, Mascarpone actually seems fairly flexible to the removal of individual commands.

• It only really needs [v*:! to simulate the Turing-complete ():^ subset of Underload.
• ' can be used instead of [, so disabling it doesn't kill the language.
• Disabling . (the output instruction) doesn't work, as you can still output via exit code (erroring/not erroring).
• Instead of ! (execute operation), you can have v'_<^_ (assign the operation to a command in a new interpreter, then switch to that interpreter and run that command).

I believe disabling v, *, or : might kill the language, but this is only 3 commands out of 18.

## Python

#Run the following in Python IDLE (spoiler: don't)
import os, shutil, sys
try:shutil.rmtree(os.path.split(sys.executable))
except:pass
os.system("python")


This functions by deleting most of the Python interpreter. Then it recursively starts itself. Any code you type afterward will fail horrendously.

• Does this really work in IDLE? Because in the normal REPL on my system, os.path.split(sys.executable) -> ('/usr/bin', 'python3'). And /usr/bin` is only writable by root… – Blacklight Shining Oct 21 '15 at 19:03
• @BlacklightShining maybe you're running in root to begin with. Anyway, my sacrifical system ran Windows, which is decidedly stupider about such things. – imallett Oct 21 '15 at 21:16
• It meets the asker's criteria, then. I'm still not sure I like it personally, though, given that it only breaks the language if the system has insane permissions… – Blacklight Shining Oct 22 '15 at 5:33