referring to opaque types

6 views
Skip to first unread message

Chris Cannam

unread,
Mar 19, 2013, 9:22:38 AM3/19/13
to yeti-lang
Is it possible to refer to an opaque type defined in one module from a
different module?

That is, if one module has something like

module a;
typedef opaque t = number;
{ makeT () = 1 } as { makeT is () -> t }

can I write any equivalent of

module b;
a = load a;
f () is () -> a:t = a.makeT (); // fictitious syntax

with an explicit type declaration?


Chris

Madis

unread,
Mar 19, 2013, 9:31:46 AM3/19/13
to yeti-lang
No, but you can use the typedef from a:

module b;
load a;
f () is () -> t = makeT ();

(you can't do as cast like in the module a that defined t)

There is TODO about accessing typedefs in another module without loading
all symbols into current scope, but it's not implemented.

Chris Cannam

unread,
Mar 19, 2013, 9:39:04 AM3/19/13
to yeti...@googlegroups.com
On 19 March 2013 13:31, Madis <ma...@cyber.ee> wrote:
> No, but you can use the typedef from a:

Ah, OK -- I can't do this in the repl though, because it no longer
loads everything into scope on a plain module load, right?

btw, while experimenting randomly I ran into this slightly inelegant
error in the repl:

$ ./yc
Yeti 0.9.7+ REPL.

> module a;
java.lang.ClassNotFoundException: code
at java.lang.ClassLoader.findClass(ClassLoader.java:522)
etc


Chris

Madis

unread,
Mar 19, 2013, 9:43:44 AM3/19/13
to yeti...@googlegroups.com

On Tue, 19 Mar 2013, Chris Cannam wrote:

> On 19 March 2013 13:31, Madis <ma...@cyber.ee> wrote:
>> No, but you can use the typedef from a:
>
> Ah, OK -- I can't do this in the repl though, because it no longer
> loads everything into scope on a plain module load, right?

It probably has never worked in REPL. The load-into-scope in REPL was a
side-effect of a bug that resulted polluting REPL scope when compiling the
module.

> btw, while experimenting randomly I ran into this slightly inelegant
> error in the repl:
>
> $ ./yc
> Yeti 0.9.7+ REPL.
>
>> module a;
> java.lang.ClassNotFoundException: code
> at java.lang.ClassLoader.findClass(ClassLoader.java:522)
> etc

Hm, yes, seems like some error checking is missing.
Reply all
Reply to author
Forward
0 new messages