Feature Request: Interfaces should suppport ivars
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with the interface and mixin examples in the issue, then read the referenced PR #3256 for context. Define what interface instance variables should mean for these examples and how the behavior can be validated; done means the desired semantics are clear and the proposed feature is specified.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This is a request for an addition to the concept of Interfaces; while I get that the inspiration for RBS interfaces are Java Interfaces, where the definition of methods, and not assomuch state, is the way to define them. However, the concept is quite limiting considering what Interfaces are used for RBS/Ruby. Interfaces are the defacto way to define duck-typing. In ruby, this is not constrained to methods, specially when one considers mixins. A random example:
module IoOps
def read_and_eval
payload = @io.read
# ...
end
end
class TCPWrapper
@io: TCPSocket
end
class SSLWrapper
@io: OpenSSL::SSL::SSLSocket
end
# given that, I'd like to define a mixin for each
interface _IOWrapper
@io: _ToIO # this interface should cover both tcp and ssl sockets
end
module IoOps : _IOWrapper # https://github.com/ruby/rbs/pull/3256
end
I think this type of mixins are common enough; Think about extensions which apply to different db adapters.
- Ngôn ngữ chính
- Ruby
- Star
- 2.2k
- Fork
- 260
- Merge trung bình
- 22 giờ 3 phút
- Pull request đã merge (30 ngày)
- 54
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/rbs
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class bodyCó thể đã có người làm @ksss đã nhận 35 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
riverqueue/river#1576 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
respond_to? on a poly receiver answers true for a program class's private or protected methodĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue in config.yaml fileĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
TheOdinProject/curriculum#31512 ·
Maintainer thường phản hồi trong vòng 1 ngày