summary refs log tree commit diff stats
path: root/compiler/options.nim
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-08-22 19:22:28 +0300
committerZahary Karadjov <zahary@gmail.com>2013-08-23 01:10:20 +0300
commitfee2a7ecfa883d100e1177b1cc7d738c6cfeaa83 (patch)
tree3e78d3bb91a49552d746192296f1c327942e3ccb /compiler/options.nim
parenta8c8a85135e73777ea2c115bf1352456c1dd69aa (diff)
downloadNim-fee2a7ecfa883d100e1177b1cc7d738c6cfeaa83.tar.gz
Experimental support for delayed instantiation of generics
This postpones the semantic pass over the generic's body until
the generic is instantiated. There are several pros and cons for
this method and the capabilities that it enables may still be possible
in the old framework if we teach it a few new trick. Such an attempt
will follow in the next commits.

pros:
1) It allows macros to be expanded during generic instantiation that
will provide the body of the generic. See ``tmacrogenerics``.
2) The instantiation code is dramatically simplified. Dealing with unknown
types in the generic's body pre-pass requires a lot of hacky code and error
silencing in semTypeNode. See ``tgenericshardcases``.

cons:
1) There is a performance penalty of roughly 5% when bootstrapping.
2) Certain errors that used to be detected in the previous pre-pass won't
be detected with the new scheme until instantiation.
Diffstat (limited to 'compiler/options.nim')
-rw-r--r--compiler/options.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/options.nim b/compiler/options.nim
index 5f173d240..cfda15f6a 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -156,6 +156,8 @@ var
 
 const oKeepVariableNames* = true
 
+const oUseLateInstantiation* = true
+
 proc mainCommandArg*: string =
   ## This is intended for commands like check or parse
   ## which will work on the main project file unless