#Follow-up question... In the other

1 messages · Page 1 of 1 (latest)

solemn maple
#

But where do I return the values of my fields?
You mean return the value of the constructor being invoked?

To clarify something:

  1. When your module constructor (as in, func New() in the Go SDK) is invoked you will get
    • parent name == name of the module
    • function name == ""
  2. When the engine asks your module for its typedefs during init (i.e. returns dagger.Module), then
    • parent name == ""

Sorry, in your last message I misread "constructor" and thought you were referring to the init where it has to returns its typedefs

indigo cairn
#

oooh

#

I guess I wasn't sure what to call it

#

Now I understand that "init" and "constructor" are 2 distinct invocations

solemn maple
#

No you saying "constructor" is correct, that's my bad, I just read too quickly

indigo cairn
#

is "" as a function name only legal when the parent name is the module name?

indigo cairn
#

Is the constructor always called, even if no arguments have been declared for it, and the module type has no declared fields?

solemn maple
indigo cairn
solemn maple
indigo cairn
#

is the name of the constructor important?

#

(dag.Function() requires a name argument)

#

Also it requires a return type argument... how do I avoid a cycle?

solemn maple
indigo cairn
#

I guess I don't have to use literally the same dagger.TypeDef instance, as long as the type name matches

#

ie. right now I have:

root := dag.TypeDef().WithObject(call.ModuleName)
#

with constructor it becomes:

root := dag.TypeDef().WithObject(call.ModuleName)
fnConstructor := dag.Function(call.moduleName, root)
root = root.WithConstructor(fnConstructor)
solemn maple