Abstract

Type safety is an important property of any type system. Modern programming languages support different mechanisms to work in type safe manner, e.g., properties, methods, events, attributes (annotations) and other structures. Some programming languages allow access to metadata: type information, type member information and information about applied attributes. But none of the existing mainstream programming languages which support reflection provides fully type safe metadata combining mechanism built in the programming language. Combining of metadata means a class member metadata combining with data, type metadata and constraints. Existing solutions provide no or limited type safe metadata combining mechanism; they are complex and processed at runtime, which by definition is not built-in type-safe metadata combining. Problem can be solved by introducing syntax and methods for type safe metadata combining so that, metadata could be processed at compile time in a fully type safe way. Common metadata combining use cases are data abstraction layer creation and database querying.

Highlights

  • The most obvious benefit of static type checking is that it allows early detection of some programming errors

  • //Accessing instance field metadata using reflection in type unsafe way: FieldInfo instanceMemberMetadata = personType.GetField("FullName"); Reflection is not type safe way to work with metadata, because a lot of configuration is done using strings instead of programming language constructions: types, fields, properties, methods, etc

  • There are 2 fundamental problems with operator ‘nameof’: It does not accept generic parameters constraining the accepting parameters and returning value types. It does not fully provide a type safe way to work with metadata

Read more

Summary

Introduction

The most obvious benefit of static type checking is that it allows early detection of some programming errors. Most of modern object oriented programming languages are strongly typed and many of them support reflection – mechanism to access metadata. //Accessing instance field metadata using reflection in type unsafe way: FieldInfo instanceMemberMetadata = personType.GetField("FullName"); Reflection is not type safe way to work with metadata, because a lot of configuration is done using strings instead of programming language constructions: types, fields, properties, methods, etc. 2015) which returns construction metadata as string object. There are 2 fundamental problems with operator ‘nameof’: It does not accept generic parameters constraining the accepting parameters and returning value types. It does not fully provide a type safe way to work with metadata

Computer and Information Science
Retrieved from
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call