# Proposal: Interfaces for more generic code

**URL:** <https://forum.crystal-lang.org/t/proposal-interfaces-for-more-generic-code/2103>\
**Category:** Community\
**Created:** [May 13, 2020, 6:12pm UTC](https://forum.crystal-lang.org/t/proposal-interfaces-for-more-generic-code/2103 "2020-05-13T18:12:01Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![funny-falcon](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/funny-falcon/32/159_2.png) [@funny-falcon](https://forum.crystal-lang.org/u/funny-falcon)\
**Post date:** [November 10, 2022, 8:25am UTC](https://forum.crystal-lang.org/t/proposal-interfaces-for-more-generic-code/2103/6 "2022-11-10T08:25:41Z")

</div>

Crystal has interfaces in Java sense:

> [@Crystal has Interfaces in Java sense](https://forum.crystal-lang.org/t/crystal-has-interfaces-in-java-sense/5105):
>
> During discussion we’ve discovered Crystal has interfaces in Java sense. Module can have abstract method, and its inclusion demands implementation: [https://play.crystal-lang.org/#/r/e1jl](https://play.crystal-lang.org/#/r/e1jl) module Moo abstract def size : Int end struct Fix include Moo end # Error: abstract `def Moo#size()` must be implemented by Fix Containers could be specialized to modules, function/method could have argument restricted to module, and their call is correctly polymorphic: [https://play.crystal-lang.org/#…](https://play.crystal-lang.org/#/r/e1jq)

---

_[View the full topic](https://forum.crystal-lang.org/t/proposal-interfaces-for-more-generic-code/2103)._
