Skip to content

Am I missing something? #12

@ghost

Description

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?

Activity

ghost

ghost commented on Nov 11, 2010

@ghost

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

added a commit that references this issue on May 22, 2013
added a commit that references this issue on Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        No participants

        Issue actions

          Am I missing something? · Issue #12 · perl11/potion