Jan 20, 2016; 12:16
Ari Najarian
Is this a 9.3.1 multiple dispatch problem?
Hi all,
Once I got 9.3.1 working on my machine, I started going through a few of my projects and seeing if there were any problems with them. Most of the code worked fine, but some of my more tangled OO code is giving me this error:
Definition Not Found: CouchCMS_field->oncreate(-key=string, -options=map) Candidates were: null->oncreate(), CouchCMS_field->oncreate(-key::string, -options::map)
I read through the conversation in this issue: http://www.lassosoft.com/rhinotrac?id=7945
And looked at this thread: http://www.lassotalk.com/Re-Multiple-Dispatch-in-9-3.lasso?277782
And read through http://lassoguide.com/language/methods.html#multiple-dispatch
My use case that generated the error above is similar to Steve Piercy’s in the linked thread: I’m trying to fall back to the parent type’s ->onCreate method, so the child type’s ->onCreate is simply passing parameters to its parent (an ‘alias’).
Here are the relevant code blocks:
// The offending call:
CouchCMS_field_calculation( -key="slug")
// The (abridged) parent type:
define CouchCMS_field => type {
data public key
data public options::map=map
...
public onCreate(-key::string, -options::map=map) => {
with i in #options->keys do {.options->insert(#i = #options->find(#i))}
.key = #key;
...
}
}
// The (abridged) child type
define CouchCMS_field_calculation => type {
parent CouchCMS_field
...
public onCreate(-key::string, -options::map=map("options"=array)) => inherited->onCreate(-key=#key, -options=#options)
}
This code was never tested on 9.2, but was written for 9.3.0 and has worked in production for months. CouchCMS_field has, like, 30 different children, some of which override the onCreate method entirely, some of which do some preprocessing before delegating up and some which are purely pass-through. Does this error (or others similar to it) look familiar to anybody? Does something about my code immediately jump out as the culprit regarding multiple dispatch?
Any insight would be much appreciated!
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso Lasso@lists.lassosoft.com
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Jan 20, 2016; 20:17
Ke Carlton
Re: Is this a 9.3.1 multiple dispatch problem?
Jan 21, 2016; 11:52
Ari Najarian
Re: Is this a 9.3.1 multiple dispatch problem?
Jan 21, 2016; 09:13
Tim Taplin
Re: Is this a 9.3.1 multiple dispatch problem?