Closed lspigariol closed 8 years ago
Could you send more information about the error raised? I guess that the problem is the order of object creation... I think it can be solved.
On Sat, Jul 30, 2016 at 8:19 PM, lspigariol notifications@github.com wrote:
fails in run time, but editor dont warnings is posible make it run?
object juan { var mascota = firulais }
object firulais { var duenio = juan }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/uqbar-project/wollok/issues/868, or mute the thread https://github.com/notifications/unsubscribe-auth/AEa1OZ6q2A320pN76S4jS0zXxAnSugVTks5qa5W0gaJpZM4JY3OQ .
fail only if the cross references is defined like example, by assignation in the initialization dont fail if the same cross references is generated later, using messages
This is the failing program
object juan {
var mascota = firulais
}
object firulais {
var duenio = juan
}
program a {
console.println(juan)
}
And this is the error.
At least the one that I could reproduce. Evaluating only the objects doesn't produce any error.
java.lang.StackOverflowError
at java.util.ArrayList.addAll(ArrayList.java:603)
at org.eclipse.xtend2.lib.StringConcatenation.appendSegments(StringConcatenation.java:290)
at org.eclipse.xtend2.lib.StringConcatenation.appendSegments(StringConcatenation.java:262)
at org.eclipse.xtend2.lib.StringConcatenation.append(StringConcatenation.java:134)
at org.eclipse.xtend2.lib.StringConcatenation.append(StringConcatenation.java:108)
at org.uqbar.project.wollok.interpreter.WollokInterpreter.resolve(WollokInterpreter.java:280)
at org.uqbar.project.wollok.interpreter.core.WollokNativeLobby.resolve(WollokNativeLobby.java:65)
at org.uqbar.project.wollok.interpreter.core.WollokNativeLobby.resolve(WollokNativeLobby.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:252)
at org.uqbar.project.wollok.interpreter.core.WollokObject.resolve(WollokObject.java:1)
(many many etc)
Where you doing that ? @lspigariol where you printing them ?
Can you please share the exact program that was failing ? Or was it evaluating then in the REPL like
> juan
(that would be the same because it prints them)
This makes me thinks that we need to control stack overflow at intepreter level and rise a "wollok" wollok.lang.StackOverFlow exception. Because we cannot avoid 100% infinite recursion in students code. This will happen eventually. And we need to fail better
the code is
object juan {
var mascota = firulais
}
object firulais {
var duenio = juan
}
in the REPL
>>> juan
ERROR [main] (WollokChecker.java:89) -
the infinity recursion problem is at initialization of both objects
the following program work correctly
object juan {
var mascota
method mascota(_mascota) {
mascota = _mascota mascota.duenio(self)
}
}
object firulais {
var duenio
method duenio(_duenio) { duenio = _duenio }
}
in the REPL
>>> juan.mascota(firulais)
>>> juan
juan[mascota=firulais[duenio=juan]]
Fixed in a branch without introducing the stack overflow control. WKO's are now registered before as the first step and then initialized. If an error occurr while initializing they are removed from the scope.
This is of course not thread safe. But enough for the moment.
Eventually it will be hard to make Wollok interpreter multithreading
Waiting to be merged.
fails in run time, but editor dont warnings is posible make it run?