Matthias Ladkau - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Matthias Ladkau

Description:

... types to Legacy Applications ? Disadvantages of types. Properties of type systems. The approach. Discussion. Introduction to ... Example in Visual Basic ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 20
Provided by: techD9
Category:

less

Transcript and Presenter's Notes

Title: Matthias Ladkau


1
A Type Transformation System for Legacy
Applications
Matthias Ladkau
STRL Seminar
2
Overview
  • Introduction to type systems
  • Why introduce types to Legacy Applications ?
  • Disadvantages of types
  • Properties of type systems
  • The approach
  • Discussion

3
Introduction to type systems
  • Assigning datatypes ("typing") gives meaning to
    collections of bits
  • A type system stipulates the ways typed programs
    may behave and makes behavior outside these rules
    illegal

In computer science, a type system defines how a
programming language classifies values and
variables into types, how it can manipulate those
types and how they interact. From Wikipedia, the
free encyclopedia
4
Why introduce types to Legacy Applications ?
  • Types assist in the comprehension of legacy
    systems
  • The introduction of a type system will bring a
    program to a more defined level
  • A type system helps to exclude some errors during
    runtime

5
Why introduce types to Legacy Applications ?
  • A type system increases the efficiency of a
    program
  • Type systems help to improve the security of a
    system
  • Programs written in different languages can
    interact much more easily if they have well
    defined data types and interfaces.

6
Disadvantages of types ?
  • Loss of Flexibility
  • Difficult when working with reflection or code
    generation during runtime
  • Increases lines of code

7
Properties of type systems
8
Static type checking
  • Favoured in compiled languages
  • All type checks are done during compiling time
  • Can only check if the data processing is right
    but not the data itself
  • Results in compiled code that executes more
    quickly.

9
Dynamic type checking
  • Appears more often in interpreted languages
  • Allows more kinds of code constructs (e.g. eval
    functions which executes arbitrary data as
    code).
  • Shortens the edit-compile-test-debug cycle
  • Makes metaprogramming more powerful and easier to
    use

10
Strong / Weak typing
  • A strongly typed language doesnt allow an
    operation to succeed on arguments which have the
    wrong type.

y 29 Result in C
int x 5, y float c 24.6 y x c Example
java.lang.Error Unresolved compilation
problems Type mismatch cannot convert from
float to int Result in Java
11
Safe / Unsafe typing
  • A language is type-safe if it does not allow
    operations or conversions which lead to erronous
    conditions

var x 5 var y "hi" var z x y Example
in Visual Basic
int x 5 char y "hi" char z x
y Example in C
z 5hi Result in Visual Basic
z Result in C
12
Equational theories
  • A type system has always an own definition of
    equality
  • Two extreme cases are
  • Nominative type systemsTypes must have the same
    name in order to be equal.(e.g. Java, C,
    Fortran)
  • Structural type systemsTypes must have the same
    structure in order to be equal.(e.g. Haskell,
    Lisp)
  • A special form of dynamic typing is duck typing
    where the language guesses which type is meant
    (e.g. Perl, Python, Ruby, Smalltalk)

13
The approach
Transformation
Translation
WSL
P1
P2
Type System 3
Type System 1
Type System 3
Type System 2
Source Code
Type System 1
14
The approach
WSL type safety
Transformation
Translation
WSL
Strong/Safe
Fortran
Weak/Safe
Perl
Weak/Unsafe
C
C
15
The approach
  • The different type systems within WSL will help
    to reduce the assumed parts of a correct code
    translation
  • The approach will introduce differential levels
    of type safety to WSL
  • The approach will prefer static type checking

16
Design decisions
  • How to identify different types ?
  • How many levels of different strong type systems
    should be defined ?
  • How typeful should the new type systems be (e.g.
    should it be possible to define Types of types
    like in Haskell) ?
  • How much should the maintainer be involved in the
    transformation process ?

17
Problems to solve
  • How to transform expressions doing pointer
    arithmetic ?
  • How can a type be safely converted into another
    ?
  • How to deal with reflection and runtime generated
    code (found in reflexive languages) ?

18
To Research
  • Which mathematical model can be used as
    foundation for this idea ?
  • What are the limitations of the approach ?
  • How to measure the type safety of a system ?
  • Maybe the term semantic equivalent can be
    defined in some other way than justwp(f1,q)
    wp(f2,q) ?q?Q

19
Thanks for your Questions!
Write a Comment
User Comments (0)
About PowerShow.com