skiplang / skip

A programming language to skip the things you have already computed
http://skiplang.com
MIT License
1.98k stars 66 forks source link

Abstract static methods on traits are too restrictive #115

Closed pikatchu closed 4 years ago

pikatchu commented 4 years ago

The following program:

trait MyTrait { static fun foo(): void; static fun bar(): void { static::foo(); } }

Gives the error: File "/home/ci/skfs/lexer.sk", line 6, characters 5-17: Invalid abstract call 4 | static fun foo(): void; 5 | static fun bar(): void { 6 | static::foo(); | ^^^^^^^^^^^^^ 7 | }

File "/home/ci/skfs/lexer.sk", line 4, characters 14-16: 'foo' is abstract. It can be used only from 'static' or a Concrete<_> object 2 | 3 | trait MyTrait { 4 | static fun foo(): void; | ^^^ 5 | static fun bar(): void {

pikatchu commented 4 years ago

So I discussed it with Todd Nowacki. We could force methods inherited from traits to be deferred by default ... but that comes with another bag of problems ... Leaving it like that for now.