diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-09-29 16:49:04 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-10-03 01:59:49 +0300 |
commit | 7e44015491d4002be3c80cb7d6797e4c63651fbe (patch) | |
tree | 6650bd361de96a9e70b75c089bf7c4521e755d9a /doc | |
parent | b28fcdfa93ccf132b878e7dcd26e36d48f107212 (diff) | |
download | Nim-7e44015491d4002be3c80cb7d6797e4c63651fbe.tar.gz |
implemented return type inference
Other fixes: * bind once is now the default for type classes as documented in the manual * fixes an issue in template overloading (erroneous ambiguity when different typedesc params were used)
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manual.txt | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index 4b7dc1aa5..4d9375f30 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -2940,6 +2940,13 @@ from the proc body. This is usually used with the ``auto`` type class: .. code-block:: nimrod proc makePair(a, b): auto = (first: a, second: b) +The return type will be treated as additional generic param and can be +explicitly specified at call sites as any other generic param. + +Future versions of nimrod may also support overloading based on the return type +of the overloads. In such settings, the expected result type at call sites may +also influence the inferred return type. + Symbol lookup in generics ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3431,7 +3438,7 @@ typedesc `typedesc` is a special type allowing you to treat types as compile-time values (i.e. if types are compile-time values and all values have a type, then - typedesc must be their type). +typedesc must be their type). When used as a regular proc param, typedesc acts as a type class. The proc will be instantiated for each unique type parameter and you can refer to the @@ -3642,15 +3649,20 @@ proc with no side effects: destructor pragma ----------------- -`RAII`:idx: -`automatic variables`:idx: -`destructors`:idx: + The `destructor` pragma is used to mark a proc to act as a type destructor. -The proc must have a single parameter, having a concrete type. +The proc must have a single parameter with a concrete type (the name of a +generic type is allowed too). + Destructors will be automatically invoked when a local stack variable goes -out of scope. If a record type features a field with destructable type and +out of scope. + +If a record type features a field with destructable type and the user have not provided explicit implementation, Nimrod will automatically -generate a destructor for the record type. +generate a destructor for the record type. Nimrod will automatically insert +calls to any base class destructors in both user-defined and generated +destructors. + procvar pragma -------------- @@ -3658,7 +3670,6 @@ The `procvar`:idx: pragma is used to mark a proc that it can be passed to a procedural variable. - compileTime pragma ------------------ The `compileTime`:idx: pragma is used to mark a proc to be used at compile |