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

Can't handle RDL.type for deferred contract #39

Open
ptarjan opened this issue Aug 30, 2017 · 1 comment
Open

Can't handle RDL.type for deferred contract #39

ptarjan opened this issue Aug 30, 2017 · 1 comment

Comments

@ptarjan
Copy link
Contributor

ptarjan commented Aug 30, 2017

If we don't want to pollute the global namespace, is there a way to annotate methods using the deferred syntax? The obvious thing didn't work:

$ cat /tmp/file.rb
require 'rdl'

RDL.type '() -> NilClass'
def foo; end
$ ruby /tmp/file.rb
/Users/pt/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdl-2.1.0/lib/rdl/wrap.rb:213:in `block in do_method_added': Deferred type contract from class RDL being applied in class Object to foo (RuntimeError)
	from /Users/pt/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdl-2.1.0/lib/rdl/wrap.rb:206:in `each'
	from /Users/pt/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdl-2.1.0/lib/rdl/wrap.rb:206:in `do_method_added'
	from /Users/pt/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdl-2.1.0/lib/rdl/wrap.rb:623:in `method_added'
	from /tmp/file.rb:4:in `<main>'
@rmosolgo
Copy link

rmosolgo commented Oct 6, 2017

👍 for an alternative to the global namespace!

The other alternative I thought of was ... refinements 😱 !

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