Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-20 Thread Stéphane Ducasse
My requirements:

no scanner to access metadata
explicit first class definition to build better tools
- need class definition (so that we can remove do it on reply) 
like in VW.
- package definition
- declarative syntax of action 
I would prefer to have an object instead of a message 
for recategorization so that 
tool can manipulate objects and not their 
implementation 
copy and pasteable 
close to coding in emacs (in the sense that it would be nice to have a 
scripting syntax also used in chunk)
cf coral http://rmod.lille.inria.fr/coral


Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-19 Thread Nicolas Cellier
2011/7/18 Stéphane Ducasse stephane.duca...@inria.fr

 But I cannot  recompile the method I fileout.
 Can you?
 May be this is because I did not use the filelist and I copied and pasted
 from the file veronica sent me.


An alternative format not using escape sequence would be to define the end
of chunk on line, like in a shell script:

cat  myfile  END
here is
my own data
END

The chunk could be chosen by default and changed only if present in method
source (or class comment or whatever).

Particularly, if you want to transcribe class comments unaltered (that is
without quoting of any form), you can't rely on any syntax to delimit the
comments, there is none.


  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.
  Yes, it is by no way meant to be human written and does not decently meet
 the requirements for scripting.
  For exchanging code, the chunk format is a bit poor too, but it is
 manageable with a good change list tool (not the squeak one).
  And remember, it was (and is still) used for logging system changes in
 the change log.
  And it is very efficient for that.
  With chunk format, you don't need quoting the code (except exclamation
 mark itself of course), and that's an important feature
  IMO, this format served its purpose very decently.
  Well, you can tell me the Squeak hacks to identify authors and timestamp
 are awfully implemented, I can only agree, but the basis are very simple.
 TSTTCPW.

 I think that it would deserve a new pass. Because very simple is not true
 when you look at the complexity = invoking the scanner to get some
 information and then poking around to know if this is a comment or a class
 definition.


Yes.
The format is mainly like this:
1) metadata
2) source

If metadata is missing or incomplete, then the tools have to try to decode
the source (generally a do-it).
This is particularly true in Squeak for a variety of actions
(I don't have an image handy, but I think removing renaming a class etc...
are in this category).


  But you can.
  You can browse the code, can't you ? go and see in .sources or .changes,
 you'll see a doubled !
  You can fileOut, then fileIn, no problem.

 I spent some days a couple of year ago in the filein fileout because I
 wanted to load all the code of squeak starting from sq10 - 3.9 and
 I can tell you that the allButLast first  kind of expressions to skip
 over ' or ! to me indicate a problem because saving a element of program
 should not be like that and this is why the format of the fileout is not
 good.
 Of course it works but it does not mean that this is good.

 Stef


Totally agree, as I said before, I don't like the implementation because it
hardly readable, maintainable, and is very inefficient...
Especially the handling of Squeak meta additions (timestamp, author).
But the format by itself is very simple.
I don't buy the terms good as an absolute reference, it must be relative
to the requirements.
Expose your requirements, then we'll can say which format is good or not.

Nicolas


Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Lukas Renggli
!! 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



Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Stéphane Ducasse
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
 




Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Nicolas Cellier
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'

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
 





Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Stéphane Ducasse


 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.

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
 
 
 
 




Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Levente Uzonyi

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










Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Nicolas Cellier
2011/7/18 Stéphane Ducasse stephane.duca...@inria.fr



  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.

Yes, it is by no way meant to be human written and does not decently meet
the requirements for scripting.
For exchanging code, the chunk format is a bit poor too, but it is
manageable with a good change list tool (not the squeak one).
And remember, it was (and is still) used for logging system changes in the
change log.
And it is very efficient for that.
With chunk format, you don't need quoting the code (except exclamation mark
itself of course), and that's an important feature
IMO, this format served its purpose very decently.
Well, you can tell me the Squeak hacks to identify authors and timestamp are
awfully implemented, I can only agree, but the basis are very simple.
TSTTCPW.


If you save a method and once it is saved you cannot load it back then what
 is the point to save it.


But you can.
You can browse the code, can't you ? go and see in .sources or .changes,
you'll see a doubled !
You can fileOut, then fileIn, no problem.


 Seriously this is not the same than with double quote.

 I don't agree


 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.

 Right, they don't mention a problem because there is no problem.
There is no problem because the ! is handled by doubling so as to not
confuse it with an end of chunk mark.

Nicolas


 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
  
 
 
 





Re: [Pharo-project] fun bug: fileouting method with a $!, produces $!!

2011-07-18 Thread Stéphane Ducasse
But I cannot  recompile the method I fileout.
Can you? 
May be this is because I did not use the filelist and I copied and pasted from 
the file veronica sent me.

 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.
 Yes, it is by no way meant to be human written and does not decently meet the 
 requirements for scripting.
 For exchanging code, the chunk format is a bit poor too, but it is manageable 
 with a good change list tool (not the squeak one).
 And remember, it was (and is still) used for logging system changes in the 
 change log.
 And it is very efficient for that.
 With chunk format, you don't need quoting the code (except exclamation mark 
 itself of course), and that's an important feature
 IMO, this format served its purpose very decently.
 Well, you can tell me the Squeak hacks to identify authors and timestamp are 
 awfully implemented, I can only agree, but the basis are very simple. TSTTCPW.

I think that it would deserve a new pass. Because very simple is not true 
when you look at the complexity = invoking the scanner to get some information 
and then poking around to know if this is a comment or a class definition. 

 But you can.
 You can browse the code, can't you ? go and see in .sources or .changes, 
 you'll see a doubled !
 You can fileOut, then fileIn, no problem.

I spent some days a couple of year ago in the filein fileout because I wanted 
to load all the code of squeak starting from sq10 - 3.9 and 
I can tell you that the allButLast first  kind of expressions to skip over 
' or ! to me indicate a problem because saving a element of program should not 
be like that and this is why the format of the fileout is not good.
Of course it works but it does not mean that this is good.

Stef