summary refs log tree commit diff stats
path: root/compiler/commands.nim
Commit message (Expand)AuthorAgeFilesLines
* next steps towards term rewriting macros; simple examples workAraq2012-08-301-0/+3
* made compiler more robust for idetools; implemented idetools.usagesAraq2012-07-301-1/+4
* implements #173Araq2012-07-281-1/+4
* cross-compilation improvementsAraq2012-07-081-2/+0
* extracted documentation generatorAraq2012-05-091-2/+1
* first steps for cleaner static/const distinctionAraq2012-03-131-0/+3
* year 2012 for most copyright headersAraq2012-01-021-2/+2
* code gen can generate code to keep alive stack rootsAraq2011-12-221-1/+1
* path canonicalization and proper project relative pathsZahary Karadjov2011-12-091-6/+4
* cleaned up configuration file handling and documented the new behaviourAraq2011-11-301-19/+13
* New algorithm for locating and loading nimrod config files.Zahary Karadjov2011-11-251-5/+33
* new compiler option tlsEmulationAraq2011-10-271-4/+5
* beginning of a taint mode; type system enhancementsAraq2011-09-241-88/+4
* documentation for --nimcache optionAraq2011-08-191-0/+1
* implemented --nimcache config option; big clean up of magic wordsAraq2011-08-191-118/+123
* support for C++ code generation; importcpp and importobjc pragmasAraq2011-08-071-1/+2
* basic thread analysis workingAraq2011-06-131-3/+3
* further steps for thread support; bootstrapping should require unzip C source...Araq2011-05-161-1/+1
* deprecated system.copy: use system.substr insteadAraq2011-05-141-2/+2
* big repo cleanupAraq2011-04-121-0/+521
ighlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
output: '''
3
1
1
1
'''
"""


block tbind:
# Test the new ``bind`` keyword for templates

  proc p1(x: int8, y: int): int = return x + y

  template tempBind(x, y): untyped =
    bind p1
    p1(x, y)

  proc p1(x: int, y: int8): int = return x - y

  # This is tricky: the call to ``p1(1'i8, 2'i8)`` should not fail in line 6,
  # because it is not ambiguous there. But it is ambiguous after line 8.

  echo tempBind(1'i8, 2'i8) #OUT 3


import mbind3
echo genId() #OUT 1


import strtabs
block tbinoverload:
  template t() =
    block:
      bind newStringTable
      discard {"Content-Type": "text/html"}.newStringTable()

      discard {:}.newStringTable
  #discard {"Content-Type": "text/html"}.newStringTable()
  t()


block tmixin:
  type
    TFoo1 = object of RootObj
      v: int
    TFoo2 = object of TFoo1
      v2: int

  proc test(f: TFoo1) =
    echo "1"

  proc Foo[T](f: T) =
    mixin test
    test(f)

  var
    a: TFoo1
    b: TFoo2


  proc test(f: TFoo2) =
    echo "2"

  Foo(a)
  Foo(b)