Skip to content
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

memory-tests.eo:32-38: Let's make sure memory can only... #2211

Closed
0pdd opened this issue Jul 5, 2023 · 10 comments · Fixed by #2430
Closed

memory-tests.eo:32-38: Let's make sure memory can only... #2211

0pdd opened this issue Jul 5, 2023 · 10 comments · Fixed by #2430
Assignees
Milestone

Comments

@0pdd
Copy link

0pdd commented Jul 5, 2023

The puzzle 761-525f7f4a from #761 has to be resolved:

# @todo #761:30min Let's make sure memory can only accept one "type" of data primitives.
# If we try to write a float into a memory that was initialized with an int, we should
# get an error. The same goes for strings and booleans. We should also make sure that
# we can't write a string that is longer than the memory size. We should also make sure
# that we can't write a number that is bigger than the memory size. And etc.
# We can also implement memory in EO instead of Java and let it use ram object.
# Let's not forget to update the "Origins of Objects" paper.

The puzzle was created by @rultor on 05-Jul-23.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

@Graur
Copy link
Contributor

Graur commented Jul 11, 2023

@yegor256 Should tuple saving in memory be prohibit?

@yegor256
Copy link
Member

@Graur yes, only int, float, string, and bool are allowed

@Graur
Copy link
Contributor

Graur commented Aug 20, 2023

@yegor256 Should a memory object only work with bytes? For example:

memory "hello" > mem
QQ.io.stdout mem.as-string # will print "hello"
QQ.io.stdout mem # will print some bytes

@yegor256
Copy link
Member

@Graur I didn't get the question. The code you suggested should work. What's wrong with it?

@Graur
Copy link
Contributor

Graur commented Aug 20, 2023

@yegor256 I would like to suggest a new implementation for the return value when storing a primitive object in memory. When we write memory "hello" > mem, the mem object should contain bytes instead of a string. In the current implementation of the memory object, it returns the string object "hello".

@yegor256
Copy link
Member

@Graur in this case this code won't work:

memory 42 > x
x.write (x.plus 1)

Here, x.plus will fail with no method .plus in bytes. Right?

@Graur
Copy link
Contributor

Graur commented Aug 20, 2023

@yegor256 Yes, you are right

maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
maxonfjvipon added a commit to maxonfjvipon/eo that referenced this issue Aug 23, 2023
@0pdd
Copy link
Author

0pdd commented Aug 24, 2023

@0pdd 2 puzzles #2434, #2435 are still not solved.

@0pdd
Copy link
Author

0pdd commented Aug 29, 2023

@0pdd 2 puzzles #2434, #2452 are still not solved; solved: #2435.

@0pdd
Copy link
Author

0pdd commented Oct 1, 2023

@0pdd the puzzle #2434 is still not solved; solved: #2435, #2452.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants