Closed jonathanstowe closed 8 months ago
Thanks. To me it looks like a bug. I'll try to take a look at it tomorrow.
I had a quick look to try and understand what was going on and didn't find anything obvious, but I was in a bit of a hurry to fix the problem it was causing in the application. Lazily in the tests I only ran the method once.
It seems the problem is the alias generated being cached (https://github.com/FCO/Red/blob/master/lib/MetamodelX/Red/Model.rakumod#L255). I'm trying to discover a better cache key to avoid that. If I can't find it, do you think it would be better to not cache at all? (I commented that line and that worked...)
Ok... It seems to work now. Could you confirm, please?
Yep that's all good now :+1:
Given an example that uses a parameterised clause in the
&on
argument tojoin-model
:You'll get:
As you can see in the second invocation it has retained the value of
$today
from the first invocation. This is consistent how ever many times it is run in the same process. Obviously this would be surprising in a long running application.This can be avoided by moving the parameterised clause into a subsequent filter:
Giving:
I'm not actually sure whether this is a real bug or that my expectations are incorrect, but I do think that it should at least be documented somewhere to avoid some scratching of heads.