xtype (halted)

Check-in [2fe1114560]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add warning about `eq` operator.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2fe1114560739a02fe445f93c3f3efbb9d1d73dfbc3f47ce8999464a6818469f
User & Date: imagic 2021-11-25 20:41:01.000
Context
2021-11-26
18:21
Implement "any" keyword and `eq` default behavior. ... (check-in: 9463c12ff0 user: imagic tags: trunk)
2021-11-25
20:41
Add warning about `eq` operator. ... (check-in: 2fe1114560 user: imagic tags: trunk)
2021-11-22
23:13
Fix rockspecs. ... (check-in: f02bdad314 user: imagic tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to README.adoc.
102
103
104
105
106
107
108



109
110
111
112
113
114
115
-- Create a multifunction.
xtype.multifunction()

-- Global multifunctions namespace for binary operators.
-- For interoperability between third-party types.
-- map of Lua binary op name => multifunction
-- (add, sub, mul, div, mod, pow, concat, eq, lt, le, idiv, band, bor, bxor, shl, shr)



xtype.op

-- Low-level API.

-- The type's xtype_stack field is a list of types ordered from the terminal
-- type to the least specific inherited types.








>
>
>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
-- Create a multifunction.
xtype.multifunction()

-- Global multifunctions namespace for binary operators.
-- For interoperability between third-party types.
-- map of Lua binary op name => multifunction
-- (add, sub, mul, div, mod, pow, concat, eq, lt, le, idiv, band, bor, bxor, shl, shr)
--
-- Warning: the `eq` metamethod has a default behavior; it should not throw an
-- error on resolution failure.
xtype.op

-- Low-level API.

-- The type's xtype_stack field is a list of types ordered from the terminal
-- type to the least specific inherited types.

Changes to src/xtype.lua.
465
466
467
468
469
470
471



472
473
474
475
476
477
478
  return string.gsub(tpl, "%$([%w_]+)", args)
end

-- Global multifunctions namespace for binary operators.
-- For interoperability between third-party types.
-- map of Lua binary op name => multifunction
-- (add, sub, mul, div, mod, pow, concat, eq, lt, le, idiv, band, bor, bxor, shl, shr)



xtype.op = {
  add = xtype.multifunction(),
  sub = xtype.multifunction(),
  mul = xtype.multifunction(),
  div = xtype.multifunction(),
  mod = xtype.multifunction(),
  pow = xtype.multifunction(),







>
>
>







465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
  return string.gsub(tpl, "%$([%w_]+)", args)
end

-- Global multifunctions namespace for binary operators.
-- For interoperability between third-party types.
-- map of Lua binary op name => multifunction
-- (add, sub, mul, div, mod, pow, concat, eq, lt, le, idiv, band, bor, bxor, shl, shr)
--
-- Warning: the `eq` metamethod has a default behavior; it should not throw an
-- error on resolution failure.
xtype.op = {
  add = xtype.multifunction(),
  sub = xtype.multifunction(),
  mul = xtype.multifunction(),
  div = xtype.multifunction(),
  mod = xtype.multifunction(),
  pow = xtype.multifunction(),