Scope modifiers: Difference between revisions

Content added Content deleted
m (→‎{{header|Wren}}: Minor tidy)
Line 1,795: Line 1,795:


In the following example, the attempt to access the private field is picked up at compile time (Wren has a single-pass 'bytecode' compiler) and so the penultimate line, although OK, doesn't print.
In the following example, the attempt to access the private field is picked up at compile time (Wren has a single-pass 'bytecode' compiler) and so the penultimate line, although OK, doesn't print.
<syntaxhighlight lang="ecmascript">class MyClass {
<syntaxhighlight lang="wren">class MyClass {
construct new(a) {
construct new(a) {
_a = a // creates an instance field _a automatically
_a = a // creates an instance field _a automatically
Line 1,808: Line 1,808:
{{out}}
{{out}}
<pre>
<pre>
$ wren scope_modifiers.wren
$ wren Scope_modifiers.wren
[./scope_modifiers line 10] Error at '_a': Expect method name after '.'.
[./Scope_modifiers line 10] Error at '_a': Expect method name after '.'.
</pre>
</pre>