Am I missing something? #12

Closed
ghost opened this Issue Nov 11, 2010 · 1 comment

Comments

Projects
None yet
0 participants
@ghost

ghost commented Nov 11, 2010

On both OpenBSD amd64 and Snow Leopard I get the following.

[james@thinkpad potion]$ ./potion                                                                                                                                                                                  
>> add = (x, y): x + y.
=> function(x, y)
>> add(2, 4) string print
nil=> nil
>>

Is this expect behavior? I would think I would get 6 returned. All tests pass when I run make test yet calling a simple function doesn't?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 11, 2010

Yes, this is expected behavior because the scope in which the interactive interpreter runs commands changes with each line. In your example, on the second line, add was nil. If you seperated the lines with a comma, it would work:
>> add = (x, y): x + y., add(2, 4) string print
6=> nil

ghost commented Nov 11, 2010

Yes, this is expected behavior because the scope in which the interactive interpreter runs commands changes with each line. In your example, on the second line, add was nil. If you seperated the lines with a comma, it would work:
>> add = (x, y): x + y., add(2, 4) string print
6=> nil

fogus pushed a commit that referenced this issue May 22, 2013

Reini Urban
#12: clear locals at vm init
Some systems do not bzero the stack memory.
Fixes some errors found with valgrind and AddressSanitizer
settuple, i.e. test/classes/monkey.pn works now

This issue was closed.

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