Segmentation fault protection: Difference between revisions

→‎{{header|Raku}}: Add a Raku example
m (→‎{{header|Phix}}: added yet/ever qualifiers and desktop first remark)
(→‎{{header|Raku}}: Add a Raku example)
Line 84:
 
Note that p2js does not support exception handling (yet) or inline assembly (ever) and of course relies entirely on the browser development tools for any and all error handling and debugging capabilities - you are expected to get things working on desktop/Phix before trying to run them in a browser.
 
=={{header|Raku}}==
Barring bugs in the compiler implementation, it should be impossible to generate a seqfault in standard Raku code. Memory is automatically managed, allocated and garbage collected by the virtual machine. Arrays are automatically managed, with storage allocation autovivified on demand. Uninitialized variables default to a Nil value, which decomposes to the base type of the variable. (If a base type was not specified, it could be Any type.)
 
<lang perl6>my @array = [1, 2, 3, 4, 5, 6];
my $var = @array[500];
 
say $var;</lang>
{{out}}
<pre>(Any)</pre>
 
If you invoke the Nativecall interface and call out into C code or libraries however, all such protections are forfeit. With great power comes great responsibility.
 
 
=={{header|Wren}}==
10,333

edits