Dale taught me something helpful (and maybe a little obscure) while fixing
ConfigurationOfXtreams...

Problem: Say you have a platform attribute #pharo4.x, and a
#customProjectAttribute #FileSystem. The problem is that the
FileSystem-related packages required for #pharo4.x are different than those
for the default cases.
        spec for: #'pharo4.x' do: [
                spec package: 'Xtreams-TerminalsFileSystem' with:
'Xtreams-TerminalsFileSystem.pharo40-SeanDeNigris.4' ]. 
        ...
        spec for: #FileSystem do: [ 
                spec package: 'Xtreams-TerminalsFileSystem' with:
'Xtreams-TerminalsFileSystem-nice.1'. ]

Solution: Nest a "spec for: #FileSystem do:" inside the "spec for: #pharo4.x
do:" declaring the #pharo4.x-specifics
        spec for: #'pharo4.x' do: [     
                spec for: #'FileSystem' do: [
                        spec
                                package: 'Xtreams-TerminalsFileSystem' with:
'Xtreams-TerminalsFileSystem.pharo40-SeanDeNigris.4' ]. 

Why it works: Per Dale, "The spec:for:do: blocks are evaluated in attribute
order (ConfigurationOfX project attributes) with top-level blocks evaluated
before nested blocks ... second level blocks are evaluated in top-level
block order after the first level block evaluation ... so having #FileSystem
nested inside of #pharo4.x and given that #FileSystem follows #pharo4.x in
attribute order means that the nested #FileSystem block inside of #pharo4.x
is evaluated after to top-level #FileSystem block allowing you to do
#pharo4.x specific overrides"



-----
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/Metacello-Resolving-Conflicting-Attributes-tp4817683.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply via email to