musictheory / NilScript

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

How do I use protocols? #57

Closed IngwiePhoenix closed 8 years ago

IngwiePhoenix commented 9 years ago

Within the tests/ folder and sneakily snuck in the README, I saw the mention of @protocol and its friends @required and @optional.

How are Protocols used? I tried to do it with @implementation MyClass <MyProtocol> but that did not work. I also added : BaseObject in the line but I still got an error, that unrecognized token < was found...

iccir commented 9 years ago

Right now, @protocol exists solely to prevent unknown selector messages - there isn't a way for a class to implement a protocol yet.

Let's use this issue to track full @protocol support.

IngwiePhoenix commented 9 years ago

Okay, works for me. :) I'll keep my protocols around for the time they become useful though. They do not cause parse errors, so no need to ditch them.

iccir commented 8 years ago

Added documentation at https://github.com/musictheory/oj/tree/1.2#protocols

IngwiePhoenix commented 8 years ago

I saw the commits - already noticed. I'm soooo excited for 1.2! :)