On Andrei's Keynote / checkedint
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 6 07:14:25 PDT 2017
On 5/6/17 12:45 PM, qznc wrote:
> I just watched Andrei's Keynote slightly delayed so I could not ask live
> via chat. One question and one remark:
>
> 1. Is there any reason to restrict this to integrals? Why not use
> Checked!(float,H) or Checked!(complex,H) or Checked!(polynomial,H)? If
> it is more general, then we should change the name as long as we still
> can (it is experimental).
I haven't tried this yet, but I'm fairly sure this can be made to work
with ease by implementing a couple of primitives: isUnsigned and
checkedOp. The latter performs a checked unary or binary operation and
returns the result along with information on whether the operation has
overflown or not. That's not enough for floating-point operations; off
the top of my head, there's underflow and loss of precision.
> 2. With respect to "Where did you steal all this money?": I recently [0]
> read about the Metaobject Protocol (MOP) and I noticed some
> similarities. MOP comes from the Lisp world, where things are more
> dynamic, but also compile-time and run-time are not that clearly
> separated. At least the intention of Gregor Kiczales and Andrei's DbI
> match. In Kiczales words from 1992 [1]: "for those cases where the
> underlying implementation is not adequate, the client has a more
> reasonable recourse. The meta-level interface provides them with the
> control they need to step in and customize the implementation to better
> suit their needs"
Thanks! I am indeed aware of MOP and Intentional Programming. They are
related but distinct. MOP is mainly concerned with mutating a program
such as adding/deleting methods, creating new types, etc. DbI focuses on
combinations - assembling components into larger components in flexible
ways.
> [0] http://beza1e1.tuxen.de/leaky_abstractions.html
Nice job writing a post so quickly!
Andrei
More information about the Digitalmars-d
mailing list