Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

"arraySubtract" function behaviour correct after flipping params #576

Closed
jphillips-bp3 opened this issue Mar 18, 2019 · 11 comments
Closed
Labels
Type: Bug 🐛 Something isn't working

Comments

@jphillips-bp3
Copy link

I have seen some odd behaviour twice now in my code and I think I have found a problem but would need someone to check the implementation of the function to be sure.

The arraySubtract function has the following documented signature:
image

But, it is behaving as if X and Y are flipped, e.g. "Removes elements of x in y".

@jeromesimeon
Copy link
Member

Looks right to me in the REPL:

Screen Shot 2019-03-19 at 8 58 22 AM

@jphillips-bp3
Copy link
Author

OK thanks for looking, will go back and re-check my code.

@jeromesimeon
Copy link
Member

I was able to reproduce the issue with the JavaScript backend, which returns [4] instead of [1].
It's definitely a bug.

@jeromesimeon jeromesimeon reopened this Mar 19, 2019
@jeromesimeon jeromesimeon added the Type: Bug 🐛 Something isn't working label Mar 19, 2019
@jphillips-bp3
Copy link
Author

Oh OK. So does ERGOTOP use a different engine, or is it the JS that is generated is being transformed incorrectly?

@jeromesimeon
Copy link
Member

jeromesimeon commented Mar 19, 2019

ERGOTOP uses an interpreter (which is meant to be used as a reference semantics). Cicero uses the compiler to JavaScript. So yes, this is a bug in the JavaScript target of the Ergo compiler.

There is no transformation once the JavaScript code has been produced (unless you consider the NodeJS compiler as one such transformation but it's unlikely to be a bug there).

@jphillips-bp3
Copy link
Author

OK thanks for the explanation, good to know how these things work.

When do you expect to get a fix done? I ask because I am due to hand over the code to the client at the end of next week, and I will need to synchronise a new release of Cicero with a change to the code.

@jeromesimeon
Copy link
Member

There is an upcoming major release which I thought this would go into. I could do a minor release just for this, but I'd rather not add that to my plate right now.

@jphillips-bp3
Copy link
Author

OK thats fine, do you have an ETA for the major release? If that is after we hand over the code then I will need to document this and tell the client they will have to make a code change.

@jphillips-bp3
Copy link
Author

jphillips-bp3 commented Mar 19, 2019

As discussed, we will stay on Cicero 0.6.3 for the client to maintain stability and document why the params are flipped.

@jeromesimeon
Copy link
Member

PR here: #580

@jeromesimeon
Copy link
Member

Done in 0.7.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants