Feature Requests: Browse | Submit New | Admin

[#11347] Allow symbols in contracts

Date:
2007-06-04 12:27
Priority:
3
Submitted By:
Benjamin Bock (beb)
Assigned To:
Nobody (None)
Category:
Interface Improvements (example)
State:
Open
Summary:
Allow symbols in contracts

Detailed description
Hi,
using contract_accessors, from time to time, I need to do forward declarations, because the class, which I want to enforce
with my accessor is not defined yet. For simple examples it is no problem to reorder the classes but when there are
circular references, there seems to be no way around forward references.

example:
class Parent
  contract_accessor :child => Child
end
class Child
  contract_accessor :parent => Parent
end

dirty workaround:
add
class Child;end
before Parent

To get around this, I propose to allow the use of symbols:
class Parent
  contract_accessor :child => :Child
end
class Child
  contract_accessor :parent => :Parent
end

This is fine for the Ruby interpreter and hopefully just a minor change.

Regards,
Benjamin Bock

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item