diff options
author | Ori Bernstein <ori@eigenstate.org> | 2018-07-14 00:07:31 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2018-07-14 00:16:06 -0700 |
commit | e8121eb38f6c825fc4638d84521c51dc6cfe761b (patch) | |
tree | a2e37178de089f90db2c8115a41edcd299921433 /doc/lang.txt | |
parent | 76ce9de16baeec77b86ece6825b90715b08545ba (diff) | |
download | mc-e8121eb38f6c825fc4638d84521c51dc6cfe761b.tar.gz |
Push down named unions types into union tags
Currently, union tags are given the type of their
enclosing union, by default:
type u = union
`Foo
;;
var x = `Foo
will currently infer the variable 'x' as having type
'union `Foo ;;'. To make the type of 'x' infer as 'foo',
the code needs to force 'x' to unify with something that is
explicitly declared as a 'u'.
This change makes it so that union tags declared in the manner
above will default to type 'u', instead. This is a special case,
but it makes the behavior less surprising.
Diffstat (limited to 'doc/lang.txt')
-rw-r--r-- | doc/lang.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/lang.txt b/doc/lang.txt index 459ac50..4dc9f12 100644 --- a/doc/lang.txt +++ b/doc/lang.txt @@ -1,6 +1,6 @@ The Myrddin Programming Language Jul 2012 - Updated Feb 2017 + Updated Jul 2018 Ori Bernstein TABLE OF CONTENTS: @@ -785,6 +785,16 @@ TABLE OF CONTENTS: unconstrained type with $t :: numeric $t, floating $t is replaced with flt64. + As a special case, a union type declared with the form + + type u = union + `Foo + ;; + + will have the default type set to the named type, and not the + union itself. This is slightly inconsistent, but it makes the + behavior less surprising. + 4.6. Built In Traits: 4.6.1. numeric: |