On 09 Jan 2015, at 15:10, Evan Donahue <emdonahu@gmail.com> wrote:
Hello,
I'm currently working on an embedding of the miniKanren logic programming language in Pharo (http://minikanren.org/ <http://minikanren.org/>) and I have run into an issue with the method compilation internals I was hoping someone could shed some light on:
miniKanren has an operator, fresh, that basically evaluates a block and returns a logic variable. My current syntax for a conjunction of logic variables is:
var1 and: var2
When I try to use the same syntax for fresh:
var1 and: [ :var2 | var2 ]
Compilation fails with "Warning: and: (or:) takes zero-arg block" which seems on first glance to come from the compiler attempting to inline my and: call. yes!
If I add an auxiliary method andFresh: that evaluates the block and and:'s the result in 2 steps, my tests pass.
What I'd like to know is: 1) Is there a work around to let me use the and: syntax here?
you can do it per method by adding the pragma: <compilerOptions: #(- optionInlineAndOr)> or per class by implementing on the class side: compiler ^super compiler options: #(- optionInlineAndOr)
2) Might my overriding of and: and or: for normal logic variables cause other problems I'm not thinking of?
I donât think so⦠Marcus