You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perform_witharguments_wrong = (
run = (
self perform: #f:b:c: withArguments: #(5 6).
)
f: a b: b c: c = (
a println.
b println.
c println.
)
)
prints:
instance of perform_witharguments_wrong
5
6
on Java SOM. This program:
perform_witharguments_wrong = (
run = (
self perform: #f:b:c: withArguments: #(5).
)
f: a b: b c: c = (
a println.
b println.
c println.
)
)
leads to:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 8
at som.interpreter.Frame.getStackElement(Frame.java:165)
at som.interpreter.Frame.copyArgumentsFrom(Frame.java:216)
at som.vmobjects.SMethod.invoke(SMethod.java:124)
at som.primitives.ObjectPrimitives$6.invoke(ObjectPrimitives.java:130)
at som.interpreter.Interpreter.send(Interpreter.java:386)
at som.interpreter.Interpreter.doSend(Interpreter.java:216)
at som.interpreter.Interpreter.start(Interpreter.java:302)
at som.vm.Universe.interpretMethod(Universe.java:332)
at som.vm.Universe.initialize(Universe.java:303)
at som.vm.Universe.interpret(Universe.java:78)
at som.vm.Universe.main(Universe.java:64)
I suspect it would be good to require that perform:withArguments checks this and throws an error if the number of arguments doesn't match.
The text was updated successfully, but these errors were encountered:
This requires a few more changes than might appear immediately necessary.
First, to make things a bit nicer, I've (slightly tortuously) added an "iter"
method to both types of Array. Then, in order to avoid the problem that Java SOM
has (SOM-st/SOM#43 (comment)), we have to
check the number of arguments passed, which means storing those in methods.
149: Implement the 'perform:WithArguments' and friends primitives. r=vext01 a=ltratt
This PR implements the various `perform:withArguments` primitives.
Some of the complexity in ef599ea is to make sure that yksom doesn't suffer from the same problems as JavaSOM (see SOM-st/SOM#43 (comment)). bf02eaa is then a simple general optimisation opened up by the first commit. I then factored out the common `perform` code in d58f3e8 which made implementing the other primitives relatively simple.
Co-authored-by: Laurence Tratt <[email protected]>
This program:
prints:
on Java SOM. This program:
leads to:
I suspect it would be good to require that
perform:withArguments
checks this and throws an error if the number of arguments doesn't match.The text was updated successfully, but these errors were encountered: