Skip to content

Allow contractual reference to yet to be defined modules #105

Open
@nixpulvis

Description

@nixpulvis

The following results in an error, despite being completely valid code without the contracts.

class A
  Contract None => B
  def foo
    B.new
  end
end

class B
  Contract None => A
  def foo
    A.new
  end
end

puts A.new.foo
puts B.new.foo

Sure I could do something like

class A
end
class B
end

at the top of the file, but this is not a good solution.

Honestly, the more I think about it, the more I think contracts belong inside the method. This will make scope issues easier (I think) because contracts are executed within the context of the method anyway. This also could allow ruby to handle issues like #104 naturally.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions