spool-lang / Spool-Legacy-Repo

Legacy repo for the Spool programming language.
3 stars 0 forks source link

Casting and Type-Checking #18

Open RedstoneParadox opened 5 years ago

RedstoneParadox commented 5 years ago

Type Checking

Like all OOP languages, Silicon provides a keyword for testing if an instance is an instance of a certain class: is. This is demonstrated in the example below:

class Foo {

}

class Bar {

}

main {
    const foo = new Foo()

    print(foo is Foo) //Prints true
    print(food is Bar) //Prints false

}

Casting

Also like all OOP languages, Silicon features polymorphism