← nimrepo

concepts_stuff, generics, and template_stuff

8310867b50806f18ffae34503b5cbaf4bc6d866b · ovidiucs · Feb 20, 2019 14:14

+18 −3 · 3 files changed

  • concepts_stuff.nim +5 −0
  • generics1.nim +11 −2
  • templates_stuff.nim +2 −1
diff --git a/concepts_stuff.nim b/concepts_stuff.nim
new file mode 100644
index 0000000..5b4e6d5
--- /dev/null
+++ b/concepts_stuff.nim
@@ -0,0 +1,5 @@
+#Copyright 2019.
+#Imports
+
+## About concepts:
+## decipher https://gist.github.com/dustinlacewell/d89d210778c449aff6496a7d6ad5d645
diff --git a/generics1.nim b/generics1.nim
index 25daa2e..759cd68 100644
--- a/generics1.nim
+++ b/generics1.nim
@@ -1,5 +1,14 @@
-# Generics are Nim's means to parametrize procs
-# Type safe containers. 
+## About generics:
+## * Generics are Nim's means to parametrize procs
+## * Type safe containers.
+## * Generics are checked when you instantiate them mostly.
+## * Generics are duck typed and very macro like.
+## * Generics are obeying module scope.
+## * Generics are a type based macro system on top of another macro system.
+## * Generics are some what similar to c++ templates
+## * Generics are typechecked after expansion.
+## * Generics are a way to create code that works on a range of type.
+## * The usage of T within the generic function is what defines the typeclass so to speak.
 
 proc `+`(a,b: string): string =
     a & b
diff --git a/templates_stuff.nim b/templates_stuff.nim
index 2332fd9..5df8e6b 100644
--- a/templates_stuff.nim
+++ b/templates_stuff.nim
@@ -21,7 +21,8 @@ from os import sleep
 ## * A template is not a proc. return doesn't work as you expect it to.
 ## * A template is a way to use one function in multiple scenarios.
 ## * Document precisely the variables that are injected by the template.
-
+## * Templates are big quasi quotes
+## * Templates and macros are metaprogramming which is basically writing code that writes code.
 
 ## Example:
 ##