How does object_id assignment work?

In MRI the object_id of an object is the same as the VALUE that represents the object on the C level. For most kinds of objects this VALUE is a pointer to a location in memory where the actual object data is stored. Obviously this will be different during multiple runs because it only depends … Read more

Practical uses for the “internal” keyword in C#

Utility or helper classes/methods that you would like to access from many other classes within the same assembly, but that you want to ensure code in other assemblies can’t access. From MSDN (via archive.org): A common use of internal access is in component-based development because it enables a group of components to cooperate in a … Read more

Are Git’s pack files deltas rather than snapshots?

Summary: Git’s pack files are carefully constructed to effectively use disk caches and provide “nice” access patterns for common commands and for reading recently referenced objects. Git’s pack file format is quite flexible (see Documentation/technical/pack-format.txt, or The Packfile in The Git Community Book). The pack files store objects in two main ways: “undeltified” (take the … Read more

How does a debugger work?

The details of how a debugger works will depend on what you are debugging, and what the OS is. For native debugging on Windows you can find some details on MSDN: Win32 Debugging API. The user tells the debugger which process to attach to, either by name or by process ID. If it is a … Read more

What does the git index contain EXACTLY?

The Git book contains an article on what an index includes: The index is a binary file (generally kept in .git/index) containing a sorted list of path names, each with permissions and the SHA1 of a blob object; git ls-files can show you the contents of the index: $ git ls-files –stage 100644 63c918c667fa005ff12ad89437f2fdc80926e21c 0 … Read more

Python string interning

This is implementation-specific, but your interpreter is probably interning compile-time constants but not the results of run-time expressions. In what follows CPython 3.9.0+ is used. In the second example, the expression “strin”+”g” is evaluated at compile time, and is replaced with “string”. This makes the first two examples behave the same. If we examine the … Read more