musictheory / NilScript

Objective-C-style language superset of JavaScript with a tiny, simple runtime
Other
50 stars 5 forks source link

Transform protocols to union types #110

Closed iccir closed 5 years ago

iccir commented 8 years ago

Right now, we only support protocols on the id type:

oj type id<Foo> becomes ts type $oj_p_Foo. oj type TheClass<Foo> is not parseable.

Instead, we should use union types:

oj type TheClass<Foo> becomes ts type $oj_c_TheClass & $oj_p_Foo oj type TheClass<Foo, Bar> becomes ts type $oj_c_TheClass & $oj_p_Foo & oj_p_Bar

iccir commented 5 years ago

This is no longer applicable in 3.0, as id<Foo> is now simply Foo.