Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,7 @@
type Foo* = object
a: string
b: string
c: int
proc createFoo*(a, b, c): Foo =
Foo(a: a, b: b, c: c)

View file

@ -0,0 +1,3 @@
var x = createFoo("this a", "this b", 12)
echo x.a # compile time error

View file

@ -0,0 +1 @@
echo repr(x)

View file

@ -0,0 +1,11 @@
import typeinfo
for key, val in fields(toAny(x)):
echo "Key ", key
case val.kind
of akString:
echo " is a string with value: ", val.getString
of akInt..akInt64, akUint..akUint64:
echo " is an integer with value: ", val.getBiggestInt
else:
echo " is an unknown with value: ", val.repr

View file

@ -0,0 +1,15 @@
class Example {
has public = "foo"
method init {
self{:private} = "secret"
}
}
var obj = Example();
# Access public attributes
say obj.public; #=> "foo"
say obj{:public}; #=> "foo"
# Access private attributes
say obj{:private}; #=> "secret"