#`currentFunctionCall().parentName()`

1 messages · Page 1 of 1 (latest)

oblique bay
#

If it's empty you're supposed to return the ModuleID with your module's type definitions. If it's not empty it will be a type that your module registered. Depends on what you created with moduleDef.withObject(...).

sour kernel
#

so it's the type name? In my case it seemed to be all lower case which is why I was having doubts

oblique bay
#

Yes. Did you register them with lower case? The engine preserves the "original name" in several places so it's possible that you register with lower case, the engine converts to PascalCase when extending the schema, but uses the original lower case value when you use currentFunctionCall().

sour kernel
#

@oblique bay I registered the main object with currentModule().Name(), because I saw another runtime do it that way. I guess that's all lowercase? Is it the correct way to do it? Should I manually capitalize the first character?

oblique bay
#

The engine will convert it for you so you're not strictly required but it can be confusing when debugging, depending on what you're exposing.

sour kernel
#

yeah it's confusing

#

Does the engine set currentFunctionCall().parentName() to exactly the type name that I registered?

oblique bay
#

It stores two versions of it. The one that’s passed around throughout the system is converted and is what ends up in the schema. The other is usually called originalName. It’s untouched and used when talking back to your module only. This pattern exists all over, when you register something with a name.

#

The goal with it was to avoid putting the responsibility on sdk maintainers to make sure casing is properly converted in several places.

sour kernel
#

Yeah I see the advantage - now that I understand what the hell is going on 😛

#

And I can see how the alternative would be a nightmare, I am definitely glad I don't have to juggle case conversion