Can't run program with stdin
I tried to run a program from the paper(p.6, 2.10) like this:
[] > hello
QQ.io.stdout > say
QQ.txt.sprintf
"The length of %s is %d"
QQ.io.stdin.next-line > x!
x.length
then eoc dataize hello. The problem is that there isn't 'data' attribute, when I run this. I tried to write QQ.io.stdout > @ instead of, but now there is a problem with stdin, I think.
First, I think it would be nice to improve example from paper. Second, I get this error after changing a program:
hello EOorg.EOeolang.EOstringν19="There is no line in the standard input stream to consume"SF
Update: I realized, that this problem bounds to line with x.length, because program works without x.length(e.g. just x). Maybe there are some problems with x as a string, maybe with stdin. Actually, I don't know
@ivan-egorov42 It is quite interesting, that such a code works and gives correct answer.
+alias org.eolang.io.stdout
+alias org.eolang.io.stdin
+alias org.eolang.txt.sprintf
[] > hello
stdout > say
sprintf
"The length is %d, the string is %s\n"
x.length
stdin.next-line > x!
[] > problem
hello.say > @

@includealex That's very funny. Now I have a question, why program works, if we just swapped two lines? (x.length and stdin.next-line > x!)
I suppose it happens because when eo dataize sprintf, it starts from the last attributes. In common, possibly, it dataize using recursion, that is why it starts from the end. So wnen it firstly tries to dataize x.length it gets null.
That's my theory.
@ivan-egorov42 I think, that problem is bounded with either stdin or sprintf. Here is a simple test, that shows that swapping lines shouldn't cause an error.
swapping-lines
@Graur, @mximp, what do you think about this so-called swapped-lines bug?
@includealex @ivan-egorov42 Indeed, it is a bug. You are welcome to fix it
@Graur, I'll try to fix this one.
@includealex Go ahead
@ivan-egorov42 now it works. Please, close the issue.
@includealex thanks!)