feat(report): write introduction

This commit is contained in:
2026-07-13 19:45:34 +02:00
parent cfeef63ae2
commit 4ec15ee6dd
4 changed files with 108 additions and 1 deletions

4
.gitignore vendored
View File

@@ -1 +1,3 @@
.vscode
.vscode
bibliography.bib.bak
bibliography.bib.sav

View File

@@ -1,3 +1,4 @@
% Encoding: UTF-8
@book{tapl,
author = {Pierce, Benjamin C.},
title = {Types and Programming Languages},
@@ -50,3 +51,51 @@
url = {https://craftinginterpreters.com/},
year = 2021
}
@book{Householder1951,
author = {Householder, Alston S.},
title = {Monte Carlo Method},
series = {Applied Mathematics Series},
number = {12},
publisher = {U.S. Department of Commerce, National Bureau of Standards},
year = {1951},
address = {Washington, D.C.},
note = {Proceedings of a symposium held June 29, 30, and July 1, 1949}
}
@Online{HOPL,
author = {Diarmuid Pigott},
title = {Online Historical Encyclopaedia of Programming Languages},
url = {https://hopl.info/},
language = {en},
urldate = {2026-07-13},
}
@Online{SO2025Survey,
title = {2025 Stack Overflow Developer Survey},
year = {2025},
url = {https://survey.stackoverflow.co/2025/technology#most-popular-technologies-language-language},
language = {en},
organization = {Stack Overflow},
urldate = {2026-07-13},
}
@Online{PythonGlossary,
title = {Python Glossary},
url = {https://docs.python.org/3/glossary.html#term-duck-typing},
language = {en},
urldate = {2026-07-13},
}
@TechReport{MCOReport,
author = {{{National Aeronautics and Space Administration}}},
title = {Mars Climate Orbiter Mishap Investigation Board - Phase I Report},
institution = {NASA Lessons Learned Information System},
year = {1999},
language = {en},
number = {641},
month = {11},
url = {https://llis.nasa.gov/lesson/641},
}
@Comment{jabref-meta: databaseType:biblatex;}

View File

@@ -1,4 +1,44 @@
#import "../requirements.typ": isc-hei-bthesis
#import isc-hei-bthesis: todo
#import "../utils.typ": quote-block
= Introduction
#quote-block[J. von Neumann @Householder1951][
Any one who considers arithmetical methods of producing random digits is, of course, in a state of sin
]
Dogs are often said to be man's best friend for their unwavering loyalty. As human beings, we thrive on patterns and predictability. On the other hand, our little animal friends can sometimes be irrational and surprise us with their unpredictable behavior. Computers however, these thought-less automatic machines made of metal, would be much better companions.
By their fundamental essence, computers and other similar machines are deterministic. As developers, we simply give them series of instructions, algorithms, functions and other scripts. Their one and only job is to execute our commands, one after the other, sometimes at the same time. An addition is always an addition, a byte is always a byte, and most importantly, a dog is always a dog.
When programming, developers use formal languages to instruct their devices to do particular tasks. Theses languages are designed to be unambiguous and generally explicit about what they describe. To the machine interpreting that written text, only one meaning is possible. "But", you may say, "sometimes there are bugs when I run my program". Of course, bugs are an inherent part of programming, but not because the machine might not understand you, because you explained it wrongly.
Errors and bugs are always caused by the human factor of computer science.#footnote[Notable exceptions are of course hardware failures which are a totally separate kind of issue]
Over the years, we have created a terrifyingly large number of programming languages#footnote[At least 8945 in 2005 according to the Historical Encyclopaedia of Programming Languages@HOPL] and developed countless tools to help developers avoid errors. Some are more famous than others, some are short-lived, and some remained obscure research projects which never made it out to the public.
While programming languages such as C and Java have long been some of the most popular among developers, another language seemed to have taken the lead in recent years. According to Stack Overflow's 2025 Developer Survey, Python is the most popular programming language among respondents, from beginners to professional developers.@SO2025Survey
Python is a very flexible scripting language, used in many fields, from small games, one-off data processing scripts and personal tooling to desktop applications and data processing pipelines. It is simple enough for beginners to easily learn it and play with it but highly expressive and with a rich ecosystem to build complex projects and production software.
One feature of Python that can be both a great benefit for lazy programmers or fast iteration, and a curse for safety and predictability is its use of duck typing. Duck typing is defined as "A programming style which does not look at an objects type to determine if it has the right interface; instead, the method or attribute is simply called or used"@PythonGlossary, applying the principle "If it looks like a duck and quacks like a duck, it must be a duck.", also known as the duck test.
Additionally, the Python language uses dynamic typing, a design principle allowing users to selectively type values, for example through type hints. These annotations are entirely optional in Python and have no direct runtime effect.#footnote[The only runtime consequence of adding annotations may be additional attributes to access them as strings at runtime] Their goal is to be interpreted by type checkers, like MyPy or Pylance, to verify a program's validity statically.
== Motivation
As explained above, Python is a very flexible language, sometimes too flexible. For beginners trying to learn programming, this can be a double-edged sword. One the one hand, the language is quite lenient and allows mixing data types, reusing variables with different types and passing values that are not at all what was expected by a function but still have the correct attributes or methods. On the other hand, it can lead to confusing behavior, when a parameter does not fit the developer's expectation or a variable is changed in some part of the code to a completely different kind of value. At the professional level, this can also prove dangerous. Mixing medical measurements or having a production service crash because of a type error can become an expensive mistake with real-world impact.
Secondly, as every Java developer can tell you, runtime errors are the worst. The dreaded `NullPointerException` continues to haunt many developers. Although some runtime errors like this are quite loud and can crash an hour-long computation process, others are much more subtle and tricky to catch. A famous example of this is the historical crash of NASA's Mars Climate Orbiter in 1999, which failed its orbital insertion due to a unit error mixing metric and imperial measurements.@MCOReport
Lastly, designing a safe code base and including tests to check that values conform to what is expected can be a tedious and often unrewarding process. Simplifying this process for user is one of the motivation for the famous Python library Pydantic, allowing users to define data structures that can validate inputs when instantiated.
== Objectives
In light of the various points exposed in the previous section, I set out to create a potential solution, a tool to help Python developers code more safely and avoid runtime type errors.
The general goal of this bachelor project is to create a type system on top of Python, using type hints, which can help detect non-trivial type errors (i.e. not necessarily structurally wrong, and also on complex types like dataframes), and produce runtime assertions to check type conformity where static checking is not possible.
The system should not impede on Python's dynamic typing philosophy. It should ensure soundness where types are annotated or inferred, while leaving the user free to omit some and perform unsafe operations.
It system must be flexible to allow checking various kinds of constraints (e.g. value domain, geometric shape, distribution, etc.) and allow extension to add support for more Python features and packages.
Finally, the system must be simple to use for average Python developers, and be able to seamlessly integrate into existing Python code.

View File

@@ -2,4 +2,20 @@
let current-offset = heading.offset
set heading(offset: current-offset + 1)
include what
}
#let quote-block(width: 10cm, who, what) = {
set par(justify: false)
align(
right,
block(
width: width,
inset: (bottom: 1cm),
quote(
attribution: who,
block: true,
what
)
)
)
}