Project

General

Profile

Actions

Feature #17

open

Allow the definition of aliases of types.

Feature #17: Allow the definition of aliases of types.

Added by Alain Prouté almost 19 years ago. Updated about 18 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
Compiler
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Platform:
Resolution:
Triage Stage:

Description

Allow the definition of aliases of types.

Updated by Anonymous about 18 years ago Actions #1

Can we have a little more explanations about this enhancement, please?

How should it works? What is the benefit compaired to a form like :

define [[ChildType]]:
  child_type(ParentType).

Updated by Alain Prouté about 18 years ago Actions #2

If you write:

type ChildType:
child_type(ParentType).

what you get is a 'clone' of ParentType which is distinct from ParentType. On the contrary an alias is just another name for the same type.

Of course, this is an important distinction since the compiler determines one and only one type for each term.

Updated by Anonymous about 18 years ago Actions #3

Alright, but what are the benefits ?

In my mind, a great enhancement can be performances, but only if a clone can't be used in place of the original (in other words, they are different types with same definition).

Example. With the form

define [[ChildType]]:
  child_type(ParentType).

the use of ChildType will create some (useless) overload because to access to the value, we need to extract the parent type. If the compiler known this is a clone, It will be able to do some optimisation and make value access as efficient as the parent (or original) type because their are exactly the same in memory.

Updated by Alain Prouté about 18 years ago Actions #4

The optimization is another problem (not yet solved). I spoke only about semantics. The 'feature' of aliases is that we may use a simple short name instead of a complicated schema applied to several types which may themselves be schemas applied to etc... This is just for comfort, readability, and maybe also a conceptual enhancement. This is still to be discussed. Anyway, aliases are not implemented yet.

Actions

Also available in: PDF Atom