Typová inference a polymorfismus pro jazyk C
Type inference and polymorphism for C
bachelor thesis (DEFENDED)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/121006Identifiers
Study Information System: 217818
Collections
- Kvalifikační práce [11242]
Author
Advisor
Referee
Šefl, Vít
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
General Computer Science
Department
Department of Software Engineering
Date of defense
14. 9. 2020
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
Czech
Grade
Good
Keywords (Czech)
překladače, programovací jazyky, typové systémyKeywords (English)
compilers, programming languages, type systemsJazyk C, i přes své stáří, stále patří mezi přední jazyky programování počítačových systémů. Jeho ceněnou přednosti je, že uživateli poskytuje takřka úplnou kontrolu nad správou paměti a nad prováděnými výpočty. C však snáší kritiku za to, že v něm chybí prvky umožňující generické programování, což se v C kompenzuje používáním preprocesorových maker, což zvyšuje náchylnost na uživatelské chyby. Tento problém již řeší jazyk C++ už od počátků svého vývoje, ale spousta vývojářů počítačových systémů jej odmítá pro jeho komplexitu a netranspar- entnost kódu. Předkládáme tedy návrh na jednodušší řešení užitím typového systému Hindley-Milner. Toto řešení pak jen za drobých úprav syntaxe jazyka C poskytne mnohem vyšší expresivitu jazyka. 1
The C language, despite its age, is one of the main languages in systems development. It is valued for giving the user almost complete control over the memory management and the computations the program written in it performs. However, a large portion of criticism of C arises from the lack of generic programming features. C compensates that by utilizing preprocessor macros, which are prone to user errors. This problem has been addressed in the early stages of the development of the C++ language, but many systems developers refuse C++ because of its complexity and non-transparency of the code. We propose a simpler solution by applying the Hindley-Milner type sys- tem extended by Haskell type classes and type constructors. We will show that this approach is viable even with minimal changes to the syntax of C, but giving it much higher expressiveness. 1