I wonder if GRPharoPlatform>>compile: aString into: aClass classified: aSymbol  
is not just duplicating logic and as such 
brings subtle bugs.

Now the addAllFilesIn: is broken 

Implementing it as 


compile: aString into: aClass classified: aSymbol 

        [aClass compile: aString classified: aSymbol] on: Error do: [:ex |  
GRError signal: 'syntax error' ]

works. I sent the information to the seaside mailing-list.
May be there are some other side effects but to me duplicating core logic 
outside of the core can be dangerous.

On Jun 30, 2013, at 10:34 AM, Stéphane Ducasse <stephane.duca...@inria.fr> 
wrote:

> Probably linked to 
> 
> addFileIn:  invokes 
> 
> 
> compile: aString into: aClass classified: aSymbol 
> 
>       "The trick here is to be as silently a possible so that the package is 
> not marked dirty when running WAFileLibrary test.
>       This also makes running tests much faster."
> 
> 
>       | methodNode compiledMethod selector methodAndNode |
>       methodNode := aClass compilerClass new 
>               compile: aString
>               in: aClass
>               notifying: nil
>               ifFail: [ GRError signal: 'syntax error' ].
>       selector := methodNode selector.
>       methodAndNode := CompiledMethodWithNode 
>               generateMethodFromNode: methodNode
>               trailer: aClass defaultMethodTrailer.
>       compiledMethod := methodAndNode method.
>       compiledMethod 
>               putSource: aString
>               fromParseNode: methodAndNode node
>               inFile: 2
>               withPreamble: [ :file | 
>                       aClass
>                               printCategoryChunk: aSymbol asString
>                               on: file priorMethod: (aClass compiledMethodAt: 
> selector ifAbsent: [ nil ]).
>                       file cr ].
>       aClass 
>               addSelectorSilently: selector
>               withMethod: compiledMethod.
>       self doSilently:  [
>               aClass organization 
>                       classify: selector
>                       under: aSymbol ]
> 
> And after it breaks nicely….
> 
> Stef
> 
> 
> 
> On Jun 30, 2013, at 10:24 AM, Stéphane Ducasse <stephane.duca...@inria.fr> 
> wrote:
> 
>> Hi esteban
>> 
>> In Seaside, I created a subclass of WAFileLibrary
>> then 
>> StefWAFileLibrary addAllFilesIn: 'foo'
>>      my folder foo contained a simple sh file
>> 
>> I got a method created in the class side of StefWAFileLibrary
>> 
>> I created a separated package and I could not save (I could save) but the 
>> method could be included.
>> I added other methods by hand and they were saved but not the methods 
>> created by the addAllFilesIn:
>> 
>> I suspect that the addAllFilesIn: did not raise a proper announcement. 
>> When I put a halt in snapshot  packageSet does not get any methods.
>> 
>> Stef
>> 
>> 
>> snapshot
>>      | packageInfo definitions categories |
>>      self halt.
>>      packageInfo := self packageSet.
>>      definitions := OrderedCollection new.
>>      categories := (packageInfo packages collect: #packageName) asArray.
>>      categories isEmpty 
>>              ifFalse: [ definitions add: (MCOrganizationDefinition 
>> categories: categories) ].
>>              
>>      packageInfo methods 
>>              do: [:ea | definitions add: ea asMCMethodDefinition] 
>>              displayingProgress: [ :ea| 'Snapshotting methods...' ].
>>              
>>      packageInfo overriddenMethods
>>              do: [:ea | definitions add:
>>                                      (packageInfo 
>> changeRecordForOverriddenMethod: ea) asMCMethodDefinition]
>>              displayingProgress: [ :ea| 'Searching for overrides in ', ea 
>> asString ].
>>              
>>      packageInfo definedClasses 
>>              do: [:ea | definitions addAll: ea classDefinitions] 
>>              displayingProgress: [ :ea| 'Snapshotting class ', ea asString ].
>>              
>>      (packageInfo respondsTo: #hasPreamble) ifTrue: [
>>              packageInfo hasPreamble 
>>                      ifTrue: [definitions add: (MCPreambleDefinition from: 
>> packageInfo)].
>>              packageInfo hasPostscript 
>>                      ifTrue: [definitions add: (MCPostscriptDefinition from: 
>> packageInfo)].
>>              packageInfo hasPreambleOfRemoval 
>>                      ifTrue: [definitions add: (MCRemovalPreambleDefinition 
>> from: packageInfo)].
>>              packageInfo hasPostscriptOfRemoval 
>>                      ifTrue: [definitions add: 
>> (MCRemovalPostscriptDefinition from: packageInfo)]]. 
>>      ^ MCSnapshot fromDefinitions: definitions
>> 
>> 
>> Stef
> 
> 


Reply via email to