Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,2 +1 @@
Demonstrate any means your language has to prevent the modification of values, or to create objects that cannot be modified after they have been created.
{{omit from|MUMPS}} <!-- All variables can be altered. -->

View file

@ -0,0 +1,4 @@
---
category:
- Initialization
note: Enforced immutability

View file

@ -0,0 +1 @@
real, parameter :: pi = 3.141593

View file

@ -0,0 +1,2 @@
subroutine sub1(n)
real, intent(in) :: n

View file

@ -0,0 +1,6 @@
*process source attributes xref;
constants: Proc Options(main);
Dcl three Bin Fixed(15) Value(3);
Put Skip List(1/three);
Put Skip List(1/3);
End;

View file

@ -1,2 +1 @@
my $pi is readonly = 3 + rand;
my $pi ::= 3 + rand; # same thing, SSA-ish form
my $pi ::= 3 + rand;

View file

@ -1,4 +1,4 @@
puts msg = "Hello World"
msg = "Hello World"
msg << "!"
puts msg #=> Hello World!
@ -12,10 +12,9 @@ rescue => e
end
puts msg #=> Hello World!
msg2 = msg
# An object is frozen and it is not a variable.
# The object is frozen, not the variable.
msg = "hello world" # A new object was assigned to the variable.
puts msg.frozen? #=> false

View file

@ -0,0 +1,8 @@
# There are two methods in the copy of the object.
msg = "Hello World!".freeze
msg2 = msg.clone # Copies the frozen and tainted state of obj.
msg3 = msg.dup # It doesn't copy the status (frozen, tainted) of obj.
puts msg2 #=> Hello World!
puts msg3 #=> Hello World!
puts msg2.frozen? #=> true
puts msg3.frozen? #=> false