[DLang Episode 115] D Language - Classes - part 8 of N - opDispatch (for class and struct)

Поділитися
Вставка
  • Опубліковано 19 гру 2024

КОМЕНТАРІ • 6

  • @MrDavibu
    @MrDavibu 16 днів тому +1

    OpOverload could be interesting for automatic vector swizzling.
    Like
    Vec3 a(5,3,1);
    Vec2 b = a.xy;

    • @MikeShah
      @MikeShah  16 днів тому +1

      Ah yes, indeed opDispatch is a great use case for swizzling.

  • @bsdooby
    @bsdooby 27 днів тому +1

    Tcl (OO) has a similar functionality, called `unknown` . Interesting feature of D; looking forward to your episodes of op*-overloading 😉

    • @MikeShah
      @MikeShah  27 днів тому

      @@bsdooby cheers! Very cool to learn about 'unknown' for tcl.

  • @disdroid
    @disdroid 26 днів тому +1

    I think when you mixin "name" it should be "this." ~ name, because you only want it to work for member functions, not statics or globals. You could also make it an expression so that it wouldn't be possible to inject extra statements inside "name".

    • @MikeShah
      @MikeShah  26 днів тому +1

      Indeed! I like those improvements 👍👍