tiflolinux.org - GNU Social
  • Login

Bienvenido

  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Monday, 15-Jul-2019 13:29:27 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
    • Wim 🈂️

    @wim_v12e sorry, i reworded the toot!

    I can do some "message passing" thing like the explained in the SICP but that's literally doing OOP.
    Are there any idioms for this?

    I have a list of elements that all of them have the same interface let's say and I have to call functions on them, but each of them have their own implementation.

    The message passing way solves this fine, but it's not really clean.
    What do you propose? some kind of pattern matching on the function that captures the type?

    In conversation Monday, 15-Jul-2019 13:29:27 CEST from mastodon.social permalink
    • Wim 🈂️ (wim_v12e@cybre.space)'s status on Monday, 15-Jul-2019 13:33:08 CEST Wim 🈂️ Wim 🈂️
      in reply to

      @ekaitz_zarraga Essentially, yes. If your code is heavily OOP, then you have encapsulated the data in objects and breaking that open would be a lot of work. So either you create a record type for each object, or if your language does not have record types, you mimic it using a map with a kind of typename field (which is what I called a "tag").
      Then you can at least patter match against that. And if your tags have some structure, you can mimic inheritance by partial matching and synonyms.

      In conversation Monday, 15-Jul-2019 13:33:08 CEST permalink
      Ekaitz Zárraga 👹 repeated this.

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

tiflolinux.org - GNU Social is a social network, courtesy of tiflolinux.org. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All tiflolinux.org - GNU Social content and data are available under the Creative Commons Attribution 3.0 license.