Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow annotations on modules #23

Open
jtoman opened this issue Mar 8, 2012 · 2 comments
Open

Allow annotations on modules #23

jtoman opened this issue Mar 8, 2012 · 2 comments
Assignees

Comments

@jtoman
Copy link
Member

jtoman commented Mar 8, 2012

Currently Rtc allows only the annotation of classes. It should also allow the annotation of modules. This will also let us do the following:

class IncluderClass
    include :module1,:module2,...
end

The includes will look up the modules, and for each module add the method annotations of that module to the current class (or theoretically, another module). Different handling for conflicting signatures will be required for this to work. That is, if module Foo defines a method bar with some signature sig1 and class A also defines bar with signature sig2, and A includes Foo, then the signatures sig1 and sig2 should not be automatically intersected, but rather the signature from A should overwrite the signature from Foo.

@jtoman
Copy link
Member Author

jtoman commented Oct 1, 2012

self annotations on modules currently work. In addition it'd be nice if we could use modules as names in the grammar, so that a method would accept only objects whose class includes the some specified module (see the set class for a use case for this).

@ghost ghost assigned j2ren Oct 3, 2012
@jtoman
Copy link
Member Author

jtoman commented Nov 18, 2012

A neat feature would allow polymorphic mixins. Something like this:

module MyPolymorphicMethods
   rtc_annotated [:t]
   typesig("test_element: (t) -> %bool")
   # ....
end
class Foo
   rtc_annotated [:k, :each_key]
   include MyPolymorphicMethods
   rtc_includes :MyPolymorphicMethods, :t => :k
end

Which would include all the methods from MyPolymorphicMethods but replace all instances of t in the typesigs with k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants