|
Hi folks.
PackageInfo >> named: aString ^ PackageOrganizer default packageNamed: aString ifAbsent: [(self new packageName: aString) register]
creates a new one when it doesn't exist, instead of throwing an error. This has already driven me to different problems difficult to debug.
What about doing something like:
PackageInfo >> named: aString ifAbsent: aBlock
^ PackageOrganizer default packageNamed: aString ifAbsent: [aBlock
value]
PackageInfo >> namedForcingNew: aString
^ self named: aString ifAbsent: [(self new packageName: aString) register].
PackageInfo >> named: aString
^ self named: aString ifAbsent: [Error signal: 'The package: ', aString, ' doesnt exist'].
The other option is to directly change PackageOrganizer and implement there:
PackageOrganizer >> packageNamed: aString ^ packages at: aString ifAbsent: [Error signal: 'The package: ', aString, ' doesnt exist'].
With this one the only non confortable is that to use it, is longer...you have to do:
PackageOrganizer default packageNamed: 'ZarazaPackage'
but it is safer than changing PackageInfo>>named
Cheers
mariano
|