Hi nicolai
Why we should not accept
foo <func: (3+4) res:0> ^ self
and be forced to put around ''
foo < func: '(3+4)' res: 0 > ^ self
I understand that we store literal but why you do not like it :).
First of all, the old compiler did not accept this. And I am a bit sensitive about changes, we allow a different syntax just because RB happens to allow this (and maybe no one knows why or it just does not happens on purpose).
valid point.
And another reason, even without my fix, if we don't put quotes around that expression, the reformatting the source will convert this to:
foo <func: #(3 #+ 4) res: 0> ^ self
What I noticed is that I could not write foo <expr: 3 + 4 result: 7> but it worked when I put () so I did it in the new code I wrote.
And, even if (3+4) looks like an expression, it is just a list of literals something like this:
foo <func: ([[[}}}) res:0> ^ self
would be allowed too. This one is ugly
But of course this is only my own opinion :)
We can change it back and maybe add support for the reformatter to not convert it to the literal array #(3 #+ 4) .
I do not know in fact this is why I asked :) Now may be my idea to use pragma to get something like pythondoctest is a bad idea but I really want to have literal programming. What do you think? If we have ' ' then it would be good that the syntax higlighter works with a special mode inside the ' '
nicolai
Stef
60220 19086 do not allow expressions as pragma arguments https://pharo.fogbugz.com/f/cases/19086 <https://pharo.fogbugz.com/f/cases/19086>