typedefs and types in error messages

15 views
Skip to first unread message

Madis

unread,
Jul 16, 2011, 4:24:14 PM7/16/11
to yeti...@googlegroups.com

Just for information.

Yeti compiler now uses typedefs to make types shown simpler - if part of
type matches a typedef available in current scope, it will show the
typedef name (with parameters) there instead of the full type. This should
help a bit with those stupidly long error messages that tend to be given
when there are nested structure/variant types.

You need latest yeti.jar, of course (and please report bugs as usual). ;)

Additionally complex module type signatures show by yeti -type module.yeti
are much more readable now (when the module defines typedefs). This
should help with the documentation generator (actually implementing
typedefs in type pretty-printing got started for this reason).

This works also in REPL, and it also allows to show the full type
description by writing typedef name followed by is:

> readFile
<yeti.lang.io$readFile> is string -> string -> (input_handle -> 'a) -> 'a
> readFile 'test' '' do f: f.write 'what' done
1:28: input_handle does not have .write field
> input_handle is
{
close is () -> (),
contents is () -> string,
lines is () -> list<string>,
rawClose is () -> (),
read is number -> string,
readln is () -> string
}

The input_handle here is a typedef from yeti.lang.io standard module.
This affects only how types are shown, the structural typing still works
exactly like it has been previously.

Unfortunately defining new typedefs in REPL is still in TODO list, but
well, not everything can be done at once. ;)

Christian Essl

unread,
Jul 17, 2011, 3:09:31 AM7/17/11
to yeti...@googlegroups.com
That's great. Thanks a lot that you still improve this wonderful language.
Reply all
Reply to author
Forward
0 new messages