flofriday / Moose

🐐 A new fun programming language
MIT License
6 stars 1 forks source link

Support of dynamic type casting #35

Closed Jozott00 closed 1 year ago

Jozott00 commented 1 year ago

We need dynamic type casting.

a: B = A()
b: A = a

class A < B {}
class B {}

Of course throws the Error:

-- CompileError ----------------------------------------------------------------

  5| b: A = a
     ^^^^^^^^

`B` does not extend declared type `A`.

But right know we have no possibility to use the dynamic type A of the variable a.

flofriday commented 1 year ago

The error we get is correct and I don't think we should allow the example above.

Dynamic cast would be nice but I don't think it is necessary for a MVP of a language. I think we should first focus on more pressing issues ;)

Jozott00 commented 1 year ago

Yes the error is perfectly fine

haha ok lets talk about it later

flofriday commented 1 year ago

I'm going to close this since we decided that for now we won't implement it for now.