From 1ed836880c3bf06b5313822c89bb06ef82915c70 Mon Sep 17 00:00:00 2001 From: flaviut Date: Tue, 21 Oct 2014 16:11:12 -0700 Subject: [PATCH] Created Common Criticisms (markdown) --- Common-Criticisms.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Common-Criticisms.md diff --git a/Common-Criticisms.md b/Common-Criticisms.md new file mode 100644 index 0000000..ecff558 --- /dev/null +++ b/Common-Criticisms.md @@ -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 +``` \ No newline at end of file