On Mon, 18 Jul 2011, Stéphane Ducasse wrote:



Why do you say so ?
I can fileOut, then fileIn without a problem.
To me, this is not a bug. This is a feature.
Source ! are doubled so as not to be confused with chunk separators, it's an 
escaping sequence like doubles quotes in String

'here''s another example which is not a bug'

this is not because people were not using a decent syntax to fileout and that 
after they hacked the system that this is not a bug.
If you save a method and once it is saved you cannot load it back then what is 
the point to save it.

Seriously this is not the same than with double quote.

Else it means that you cannot/should not use $! in Smalltalk method. And I read 
most of the spec and books on smalltalk
and nobody ever mentioned that. Here this is just that this is doing the wrong 
behavior.

You can use $! in methods, but you can't use them in preambles. Also you shouldn't use any non-ascii (charcode > 127) characters in the preamble if you want to read it back again.

If you don't trust me, then just check your image, I'm sure it has a few hundred methods containing the ! character.


Levente


Imagine that we save the code using the coral syntax then what we would not use 
[] anymore in method?

Stef


Nicolas

2011/7/18 Stéphane Ducasse <stephane.duca...@inria.fr>
Yes I know.
To me, saving a method should make sure that we can reload it and this is not 
the case.
So to me this is a bug.

try to fileout

getPreambleFrom: aFileStream at: position
       |  writeStream |
       writeStream := String new writeStream.
       position to: 0 by: -1 do: [ :p |
                       | c |
                       aFileStream position: p.
                       c := aFileStream basicNext.
                       c == $!
                               ifTrue: [^ writeStream contents reversed]
                               ifFalse: [writeStream nextPut: c]]


:)

I do not see why the system should not save it correctly even if !! is used as 
a chunk separator.

Stef


On Jul 18, 2011, at 4:55 PM, Lukas Renggli wrote:

!! Is the escaping of a single ! (like '' is the escaping of ' in a
string), because the ! Is used to separate junks.

Lukas

On Monday, 18 July 2011, stephane ducasse <stephane.duca...@free.fr> wrote:
Hi

with veronica we found a fun bug.
If you have a method with a $! and you file it out. you get $!! in the 
fileouted file.

       http://code.google.com/p/pharo/issues/detail?id=4531

Stef


--
Lukas Renggli
www.lukas-renggli.ch






Reply via email to