Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Merge pull request #6 from cdrubin/patch-1

  • Loading branch information...
commit 1a454e12846a65bd2bb8b61b957d397d6394d76e 2 parents 460c639 + c55b297
@nddrylliog nddrylliog authored
Showing with 6 additions and 8 deletions.
  1. +6 −8
@@ -1,4 +1,3 @@
When to use covers and classes
@@ -33,18 +32,17 @@ Classes are by-references. Which means every object is a reference. Doing that:
answer := Number new(42)
- modify(answer) // does nothing
+ modifyRef(answer) // does nothing
-What happens in 'modifyRef' is that we change what 'n' refers to in the
-modifyRef function. It doesn't modify what 'n' referred to in the first place,
-in this case the 'answer' variable we gave it as argument. So 'modifyRef' has
+What happens in 'modifyRef' is that we change the value of the parameter 'n'.
+The code does not modify what 'n' was a reference to in the first place.
+In the example above the variable 'answer' is given as the argument and 'modifyRef' has
no effect at all on 'answer'.
-However, in 'modifyInside', we modify the content of what 'n' refers to.
-Since 'n' refers to 'answer', the content of 'value' is modified, ie its value
-is changed to -1
+However, in 'modifyInside', we actually modify the content of what 'n' refers to.
+Since 'n' refers to 'answer', the code will modify its member 'value' and set it to -1.
### Covers ###

0 comments on commit 1a454e1

Please sign in to comment.
Something went wrong with that request. Please try again.