apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

Type aliases #132

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Implement type aliasing support, C++ typedef style. Consider also the ability 
to define types which use the same underlying representation but are not 
implicitly convertible.

For instance:

alias NaturalNumber -> integer

foo : NaturalNumber x { ... }
bar :
{
    NaturalNumber a = 2
    integer b = 3

    foo(a)  // ok
    foo(b)  // also ok
}

type Inches -> integer
type Pixels -> integer

foo : Inches x { ... }
bar :
{
    Inches width = 3
    Pixels height = 506

    foo(width)  // ok
    foo(height) // semantic error
}

Original issue reported on code.google.com by don.ap...@gmail.com on 15 Feb 2012 at 8:12

GoogleCodeExporter commented 9 years ago
Both weak and strong type aliases are implemented in trunk and will ship with 
Release 13.

Original comment by don.ap...@gmail.com on 27 Apr 2012 at 7:49