Created Common Criticisms (markdown)

This commit is contained in:
flaviut 2014-10-21 16:11:12 -07:00
parent 74f4190358
commit 1ed836880c
1 changed files with 10 additions and 0 deletions

10
Common-Criticisms.md Normal file
View File

@ -0,0 +1,10 @@
## Callsite annotations on var parameters would decrease mistakes
Possibly. The problem here is that of perception. In many languages, heap allocation through pointers is the only method of having objects, and passing them to a function gives the freedom to modify them. In Nim, things can be allocated on the stack, and those things need to be treated in the same way as things on the heap.
``` nimrod
proc foo(input: ref T) = ...
let a: ref T
foo(a) # valid, this is Java-style
var b: T
foo(b) # also valid and equivalent
```