I don’t think it would end up much cleaner. For initWith to support all the functionality of initArg would require each argument to be a struct containing corresponding keys for ref, dsl, value, and javaCast. So your example would look more like:
argStruct = {
coldbox = {
value = getColdBox()
},
gateway = {
name = “UserGateWay”
},
objectType = {
value = “User”
}
};
mapPath(“model.user.UserService”).asSingleton().initWith(argumentCollection = argStruct);
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com