Hacker News new | ask | show | jobs
by wahern 897 days ago
I didn't comprehensively investigate the issue to learn whether this reflected a more systematic change in reported types, but FWIW a code comment from some Lua bridging code:

  -- 2022-12-30: On macOS 12/x86_64 methods returning BOOL return integers
  -- from objc.msgsend as the type encoding uses the 'c' code for char rather
  -- than 'B' for _Bool (C) or bool (C++). But on macOS 11/arm64 the type
  -- encoding is 'B' and we get a boolean return type.
  local function itob(v, err)
          if isinteger(v) then
                  return v ~= 0
          elseif isboolean(v) then
                  return v
          else
                  return error(err or sformat("expected boolean or integer, got %s", type(v)), 3)
          end
  end