s-ol’s avatars-ol’s Twitter Archive—№ 2,598

      1. …in reply to @redblobgames
        @redblobgames @stevekrouse @LewisJEllis Lua and Python both solve the same issue better IMO, in different ways. In both languages a.member() is equivalent to b = a.member b() But that means something else in the two cases:
    1. …in reply to @S0lll0s
      @redblobgames @stevekrouse @LewisJEllis Python preserves this as "method calls" by making a.member be a "bound function" by default. It sounds like this might have a downside in memory usage? Lua on the other hand makes the this/self parameter explicit in function definition and doesn't pass it for "a.b" invocations
  1. …in reply to @S0lll0s
    @redblobgames @stevekrouse @LewisJEllis for method calls you use the ":" syntax, which has its own equivalent: a:member() is the same as b = a.member b(a) This isn't as comfortable as Python, but it's as consistent. It would be neat if "b:member" was a "bound function" but that doesn't exist in Lua unfortunately.