Drew DeVault 10/5/2021

How reflection works in Hare

Read Original

This article details the implementation of reflection in the Hare systems programming language. It covers the concept of reflection, which allows programs to examine and manipulate types at runtime. The article provides a sample program demonstrating how to use the 'type' keyword and 'types::reflect' function to obtain type information such as unique ID, size, and alignment. It also describes the 'typeinfo' structure, including fields like 'id', 'sz', 'al', and 'repr', which is a tagged union for different type representations (e.g., builtin types like int). The explanation is technical and focused on programming language design, making it relevant to IT/technology.

How reflection works in Hare

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet