version 0.8.2

This commit is contained in:
rumpf_a@web.de 2009-10-21 10:20:15 +02:00
commit 053309e60a
125 changed files with 6564 additions and 1308 deletions

25
tests/toverprc.nim Executable file
View file

@ -0,0 +1,25 @@
# Test overloading of procs when used as function pointers
import strutils
proc parseInt(x: float): int = nil
proc parseInt(x: bool): int = nil
proc parseInt(x: float32): int = nil
proc parseInt(x: int8): int = nil
proc parseInt(x: TFile): int = nil
proc parseInt(x: char): int = nil
proc parseInt(x: int16): int = nil
type
TParseInt = proc (x: string): int
var
q = TParseInt(parseInt)
p: TParseInt = parseInt
proc takeParseInt(x: proc (y: string): int): int =
result = x("123")
echo "Give a list of numbers (separated by spaces): "
var x = stdin.readline.split.each(parseInt).max echo x, " is the maximum!" echo "another number: ", takeParseInt(parseInt)