Jump to content

Sealed classes and methods: Difference between revisions

J
(Added FreeBasic)
(J)
Line 63:
Lisa is watching the movie...
Sorry, Fred, you are too young to watch the movie.</pre>
 
=={{header|J}}==
No J compilers have been released (though some people have claimed to be working on such things). That said, J does provide a locked script mechanism which might be thought of as compiled code (which depends on libj).
 
J, by default, does not support sealed classes (nor methods). However, sealed classes could be implemented by altering J's <code>coinsert</code> (which implements inheritance) to omit sealed classes.
 
For example, we could say that a class which contained any implementation of <code>final</code> is a sealed class:
 
<syntaxhighlight lang=J>coinsert=: {{
l=. (#~{{0>nc<'final__y'}}"0);: :: ] y
p=. ; (, 18!:2) @ < each l
p=. ~. (18!:2 coname''), p
(p /: p = <,'z') 18!:2 coname''
}}</syntaxhighlight>
 
J does not provide a mechanism to seal individual methods.
 
=={{header|Phix}}==
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.