Hi,
The background to the question is that I'm trying to repackage LanguageBoxes so that both the Squeak and Pharo community can use its features (or just parts of it).
Cutie-Helvetia defines a class, CURaisedToExample. Among others, it defines two methods: CURaisedToExample class >> #raise:to and CURaisedToExample >> testSplice.
The latter makes use of QQCompiler's splice operation (just like Common Lisp's) - @foo will replace 'foo' with whatever 'foo' evaluates to, so compiling 'a := @(3 + 4)' means the same thing as 'a := 7'. Now testSplice says
self assert: `@(self raise: 2 to: -3) = (1/8).
which means that, _at_compile_time_, testSplice will invoke #raise:to: (the self refers to the class-side method)... and at this point in time #raise:to: has been compiled, but not installed. Compiling #testSplice fails with a MessageNotUnderstood, and package loading aborts.
My question is this: how can I work around this? Can I move the installation of #raise:to: to a preload step?
Some hacks that spring to mind, and don't seem very pleasant, are: * introduce a new superclass defining the method, put that in a seperate package, and load that package before Cutie-Helvetia * move the definition of CURaisedToExample and #raise:to: to a separate package, and make all the tests extensions to that package.
frank
On 25 December 2011 22:18, Frank Shearar frank.shearar@gmail.com wrote:
Hi,
The background to the question is that I'm trying to repackage LanguageBoxes so that both the Squeak and Pharo community can use its features (or just parts of it).
Cutie-Helvetia defines a class, CURaisedToExample. Among others, it defines two methods: CURaisedToExample class >> #raise:to and CURaisedToExample >> testSplice.
The latter makes use of QQCompiler's splice operation (just like Common Lisp's) - @foo will replace 'foo' with whatever 'foo' evaluates to, so compiling 'a := @(3 + 4)' means the same thing as 'a := 7'. Now testSplice says
self assert: `@(self raise: 2 to: -3) = (1/8).
which means that, _at_compile_time_, testSplice will invoke #raise:to: (the self refers to the class-side method)... and at this point in time #raise:to: has been compiled, but not installed. Compiling #testSplice fails with a MessageNotUnderstood, and package loading aborts.
My question is this: how can I work around this? Can I move the installation of #raise:to: to a preload step?
Some hacks that spring to mind, and don't seem very pleasant, are:
- introduce a new superclass defining the method, put that in a
seperate package, and load that package before Cutie-Helvetia
- move the definition of CURaisedToExample and #raise:to: to a
separate package, and make all the tests extensions to that package.
My general question still stands, but I worked around the issue by moving the fixtures - #raise:to: - to a superclass CURaisedToFixtures, and put that superclass in its own package.
frank
squeak-dev@lists.squeakfoundation.org