-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add inclusive array operator #148
base: master
Are you sure you want to change the base?
add inclusive array operator #148
Conversation
Everything worked fine until I touched In other news in PUSH(VAR_OBJ(newRange(vm, (double)AS_NUM(from), (double)AS_NUM(to)))); REPL result:
Indepedent of this there was an 'informational' (for lack of a better term) error too:
Correct me if I am wrong but my adjustments to that display only occur in REPL mode and so wont |
As I've said here #142 (comment), you shouldn't add a boolean
char* buf_operator;
if (range->inclusive) {
buf_operator = malloc(2);
buf_operator = "..";
} else {
buf_operator = malloc(3);
buf_operator = "...";
} This is exactly what I meant when I say, "to check if the range is inclusive or exclusive at different places in our code" Our range are always exclusive, but when we're creating one, depend on the syntax we change the limit of the range. Ex:
If you find #142 (comment) harder to understand let me know, I'll help you with detailed explanation on how to do it. |
I think there's been some miscommunication here @ThakeeNathees -- I have not implemented the core logic using a My questions about How do you want to solve the REPL problem? I don't see a way to have |
The alternative is we leave the REPL saying |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative is we leave the REPL saying 1..6 for a range defined as 1..5 and 1..5 for a range defined as 1...5 but I don't think this is very clear at first glance.
Simple. Add a period .
to the toString() of range object (because all ranges are exclusive internally)
- pkByteBufferAddString(buff, vm, "..", 2);
+ pkByteBufferAddString(buff, vm, "...", 3);
This will print like below
>>> 1..5
[Range:1...6]
>>> 1...5
[Range:1...5]
inclusive
works; howeverinclusive
for the purposes of deciding between...
and..
in the REPL print feedback. This broke everything that worked before, likely because I don't fully understand the VM yet and am managing something. I've submitted it like this for general feedback of "don't worry about the REPL print yet" or "let's try and fix the REPL print".