How are java interfaces implemented internally? (vtables?)

The key feature of the HotSpot JVM is inline caching. This doesn’t actually mean that the target method is inlined, but means that an assumption is put into the JIT code that every future call to the virtual or interface method will target the very same implementation (i.e. that the call site is monomorphic). In … Read more

What is the connection between laziness and purity?

You’re right, from a modern POV this doesn’t really make sense. What is true is that lazy-by-default would make reasoning about side-effectful code a nightmare, so lazyness does require purity – but not the other way around. What does require lazyness though is the way Haskell in versions 1.0–1.2, following its predecessor Miranda, emulated IO … Read more

Why does Python have a limit on the number of static blocks that can be nested?

This limit not only applies to for loops, but to all other control flow blocks as well. The limit for the number of nested control flow blocks is defined inside of code.h with a constant named CO_MAXBLOCKS: #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ This constant is used to set … Read more

How is the C++ exception handling runtime implemented?

Implementations may differ, but there are some basic ideas that follow from requirements. The exception object itself is an object created in one function, destroyed in a caller thereof. Hence, it’s typically not feasible to create the object on the stack. On the other hand, many exception objects are not very big. Ergo, one can … Read more

Why are all fields in an interface implicitly static and final?

An interface is intended to specify an interaction contract, not implementation details. A developer should be able to use an implementation just by looking at the interface, and not have to look inside the class which implements it. An interface does not allow you to create an instance of it, because you cannot specify constructors. … Read more

PyPy — How can it possibly beat CPython?

“PyPy is a reimplementation of Python in Python” is a rather misleading way to describe PyPy, IMHO, although it’s technically true. There are two major parts of PyPy. The translation framework The interpreter The translation framework is a compiler. It compiles RPython code down to C (or other targets), automatically adding in aspects such as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)