jckarter/clay — pull request #478 by agemogolk (2013-01-13 18:22:31+00:00)
Title: Final overloads

Implemented final overloads as discussed in #464, #383, #334.

* Overloads defined using the 'overload' keyword are final.

```
define foo;
overload foo(x) {} // foo(x:T) is final
overload foo(y:Int) {} // ambiguous match error
```
* Overloads defined using the 'default' keyword can be overridden by subsequent 'default' definitions and 'overload's.

```
define foo;
default foo(x) = false;
default foo(x:Int32) = true; //OK as foo(x:T) not final
overload foo(x:Float32) = true; //OK as foo(x:T) not final
default foo(x:Int32) = false; //OK as foo(x:Int32) not final
```
* Default overloads may be defined in any module.
* Standalone functions are unchanged.

Final overloads are switched off by default to allow the library to be incrementally updated. A compiler flag '-final-overloads' has been added to turn final overloads on.

The library has been updated with 'default' overloads to allow the bindgen tool and hello world example to compile with final overloads enabled.

Some simple tests have been added using the -final-overloads flag.

Issues:

The ambiguous match error output is currently untidy and possibly too verbose.