Skip to content

Incoherent behaviour #19

Description

@RedNeath

Hey! How are you doing?

I just wanted to point out that this part of the code is kind of misleading.

'-' => function ($a, $b=null) {
if ($b===null) {
return -$a;
} else {
return $a - $b;
}
},

In the javascript implementation, for the minus operation, the verification is undefined, not null (see this).

The problem is that, with the js implementation, if you try to put two items, the second one being null, you will end up with the first item as a result. However, if you do the same in PHP, you will end up with the opposite of the first item.

I think this is quite a bad thing, since most people (just as I did) will probably test your library on your website, using the js implementation, and then start building their use case with this functioning in mind, and encounter problems if they use a different implementation.

So what should we do? It's up to you to decide, but I think it really is necessary to remain coherent between the multiple implementations you developed over the time 😄

Have a nice day!

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions