Respond to an unknown method call: Difference between revisions

m
Fixed lang tags.
m (→‎{{header|JavaScript}}: Clean up the wording...)
m (Fixed lang tags.)
Line 17:
(format nil "Do something to ~w." thing))</lang>
 
Evaluating <lang lisp>(list (do-something 3) (do-something 4))</lang> produces
 
<lang lisp>("Do something to 3."
>("Do something to 3."
"No method for #<STANDARD-GENERIC-FUNCTION DO-SOMETHING 214FC042> on (4).")</lang>
 
Line 117 ⟶ 116:
=={{header|OCaml}}==
It is not possible in OCaml to call an undefined method, it will fail when trying to compile the code with an error message:
<lang ocaml>Error: This expression has type example
It has no method ding</lang>
 
=={{header|Perl}}==
Line 227 ⟶ 226:
Here is an example of unknown methods being used to call shell commands (this is already defined in the base image):
 
<lang slate>define: #shell &builder: [lobby newSubSpace].
define: #shell &builder: [lobby newSubSpace].
 
_@shell didNotUnderstand: message at: position
Line 251 ⟶ 249:
ifFalse: [args do: [| :arg | command ; ' ' ; arg]]]]] writingAs: String)
ifNil: [resend] ifNotNilDo: [| :cmd | [Platform run: cmd]]]
].</lang>
</lang>
 
Here is an example of it being used:
 
<lang slate>slate[1]> shell ls: '*.image'.
slate[1]> shell ls: '*.image'.
kernel.new.little.64.1244260494374694.image slate2.image
net.image slate.image
True
slate[2]> </lang>
</lang>
 
=={{header|Smalltalk}}==
Anonymous user