@@ -7,11 +7,11 @@ than one type, but all values belong to at least one type. We say that a value
77A class is a form of type. Values are called _ instances_ if they belong to a
88class.
99
10- An interface is a form of type . If ` v ` is an instance of class ` C ` , which
11- implements interface ` I ` , then ` v is I ` gives a truthy result.
10+ Interfaces are types . If ` v ` is an instance of class ` C ` , which implements
11+ interface ` I ` , then ` v is I ` gives a truthy result.
1212
13- An enum is a form of type . An enumeration constant ` E.e ` belongs to exactly one
14- enum ` E ` , namely the one it was declared in.
13+ Enums are types . An enumeration constant ` E.e ` belongs to exactly one enum ` E ` ,
14+ namely the one it was declared in.
1515
1616The built-in types ` Int ` , ` Str ` , ` Bool ` , ` Array ` , ` Dict ` , ` Set ` , ` Bag ` , and
1717` Map ` are also types.
@@ -20,25 +20,14 @@ Types exist both at compile time and at runtime. The declaration forms for
2020classes, interfaces, and enums make sure to make the newly declared type
2121available at compile time. Declaring a variable or parameter or return value to
2222be of a given type is also a compile-time notion. The expression occurring on
23- the left of a colon (` : ` ) in a declaration must be constructible at compile
24- time so that the compilation can see it and make use of it.
23+ the left of a colon (` : ` ) in a declaration must be available at compile time so
24+ that the compilation can see it and make use of it.
2525
2626On the other hand, all the core features of Alma are guaranteed to work without
2727such type annotations. Alma is a dynamically typed language, in the sense that
2828the program needs to be well-formed syntactically and with respect to scoping
29- in order to run, but does _ not_ need to pass any checks made by the type
30- inference algorithm. The adage "well-typed programs do not go wrong" reminds us
31- that when a (sound) type-checker has given our program its blessing, certain
32- classes of runtime error are ruled out. Alma has good support for static typing
33- in the sense that Alma's type-checker provides the same guarantee -- but you're
34- not prevented from running the program absent this guarantee, it's just that
35- you do so with the understanding that those runtime errors are not ruled out.
36-
37- As a rule, it's safe to think of the program as existing on a level separate
38- from the type annotations, and having meaning independently of them. Type
39- annotations are fully aware of the program, but the program is not aware of
40- type annotations, and cannot change its behavior based on what the type
41- annotations say. Gilad Bracha calls this a _ pluggable type system_ .
29+ in order to run, but does _ not_ need to pass any checks made as part of type
30+ inference.
4231
4332## 6.1 Array types
4433
0 commit comments