Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow recursive contract definitions #43

Open
gregwebs opened this issue Apr 19, 2012 · 2 comments
Open

Allow recursive contract definitions #43

gregwebs opened this issue Apr 19, 2012 · 2 comments

Comments

@gregwebs
Copy link

This is a very confusing error message. In this case:

MyC = ?({ myc: -> MyC })

The message should be: "recursive contract 'MyC'", please use Self

@disnet
Copy link
Owner

disnet commented Apr 19, 2012

Wow, that is a terrible error message.

I wonder if instead of throwing an error we could just allow recursive definitions and add the self implicitly? You'd still need to explicitly use self sometimes for nested objects:

Obj = ?{ my_obj: Obj, inner: { inner_obj: Self}}
# or if we get fancy
Obj = ?{ my_obj: Obj, inner: { inner_obj: Obj.inner}}
# but even then we could never completely drop self
Fun = ?(Num, { my_obj: Self }) -> Any

Think it's worth allowing recursive definitions or just keep the single self way (with a better error message)?

@gregwebs
Copy link
Author

I like the recursive definitions: that is what I tried first. Keeping Self is fine though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants