delvingbitcoin

Type Erasure & Script

Type Erasure & Script

Original Postby Chris_Stewart_5

Posted on: March 12, 2024 19:51 UTC

The discussion revolves around the concept of type erasure and its applicability to programming languages, particularly focusing on the difference between compiled languages and interpreted scripts.

Type erasure pertains to the removal of explicit type information after the compilation phase, a feature inherent to statically typed languages such as Java, C++, and Rust. These languages undergo a compilation process transforming high-level code into machine code.

On the other hand, the conversation highlights that scripts, unlike compiled languages, are interpreted rather than compiled. This fundamental distinction brings into question the relevance of introducing a type system at the script level, which inherently lacks a compilation phase that translates code into machine code. The argument extends to the comparison with machine code itself, pointing out that architectures like x86 and arm64 operate without an explicit type system. The implication is that if these foundational levels of computing do not incorporate type systems, there might be little justification for introducing such complexity at the script level, which operates closer to machine code in terms of abstraction.

Furthermore, the discourse touches upon Miniscript, hinting at its efforts possibly aligning with the concept of integrating more structured or typed approaches within scripting contexts. However, the overarching skepticism towards the practicality and necessity of enforcing a type system in environments traditionally devoid of such structures remains a focal point of the conversation. This skepticism is rooted in the nature of scripting as an intermediary form closely resembling machine code, where the absence of types is a norm rather than an exception.