-
Notifications
You must be signed in to change notification settings - Fork 22
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
Compiler hangs when compiling circular imports #285
Comments
Good question! although I note Kernan says
I generally try to check language level things across both kernan and e.g. amg. We're pretty keen on fixed, comprehensive order of evaluation. This would change the order of evaluation depending on which file was run first. Also, modules are nested inside dialects, and your transformation doesn't account for those. |
Yes I see the problem with respect to evaluation order. I was thinking of this myself, and came up with a As for other side-effects (e.g. I/O), I don't personally see the problem with the evaluation order depending on which file is compiled first, as one is likely to compile a project from the same main file each time. As for dialects, that's a good point. Perhaps we could add support for dialects in objects? |
yeah. the syntax is (mostly) clear. the fun is actually the interaction of two or more dialects - how much of the enclosing scope or dialect do you keep? Currently that's a low priority for me, but there's certainly research around dialects (like making them go fast in Moth without hardcoding everything).
We still hates outer my precious! |
Why not Of course |
we still hates outer my precioussssss
you can't have |
Sure, encapsulation and all that... but As for the linked issue, I don't even see why you need confidential at all... Isn't lexical scoping sufficent?
Now the result of C has it's private state (i.e. |
Also, if you allow
As a side note, if you allow |
Sure, encapsulation and all that... but x.outer makes perfect sense!
it makes sense, but it's still a bad idea.
If it's not the syntax, what is you're problem with outer? If you're going to have a language with nested objects, why wouldn't you have it?
because - with a semantic definition for nesting, you don't need it.
O'CAML names "self" for each object explicitly with extra syntax.
In Grace you can name objects internally or externally
def externalName = object {
def internalName = self
...
if encapsulation is calculated on the dynamic relationships between objects,
then you don't need special syntax. I think a type checker would still need
to track those relationships, ditto a VM, although caching may fix things.
for what it's worth, this is again research - James
|
This conversation seems to have gone off the rails. Outer is not a message, and never has been. Then delete this comment and all the garbage about outer. |
The “why” is that the original implementor of Grace was adamant that recursive dependencies are a bad idea. Certainly they are confusing to novices, but we do have use-cases (#282) in setting up the environment where they can be useful. As the OP points out, recursive objects are actually rather common, and attempts to read the value of an uninitialised |
If I have a file
a.grace
with:and a file
b.grace
withCompiling either one of them with
mgc
causes the compiler to hang without printing anything.I understand that the grace spec forbids such modules, but I am curiouse as to why.
Why not just make them syntax sugar for objects, e.g:
my above code could be treated as equivalent to
The text was updated successfully, but these errors were encountered: