The de facto input to all inject attribtues has always been dsl which makes a lot of sense. As such, people always expect to be able to use namespaces like `coldbox:setting;foo` by default anywhere they ask WireBox for something. The notable exception to this is the getInstance() call, which uses "name" as the first argument so the following doesn't work
Now, this is possible by switching to named params like so:
I think defaulting to name back when this was called getModel() made more sense, but there's really no point in not just allowing dsl for everything at this point. If anyone wants to specifically get a model (the exception, not the rule) they can get the old behavior back with
This will also allow for a cleaner syntax when providing init args to your model. I recommend that the first param be set to dsl but the getIstance() get updated to check for "arguments.name" and if it exists and dsl is not passed, then we just do
behind the scenes which will provide for very nice backwards compatibility since both of these existing ColdBox 5 use cases would continue to work out of the box with zero app changes which probably accounts for 95% of the use cases.
This will technically be a breaking change, so it needs to happen in ColdBox 6.
I am reviewing ways to do this, since there is always a rabbit hole, because the get by dsl ultimately either returns an object from a factory or delgates back to getInstance() again with the appropriate name. So we can’t remove the name.
I might just prefer a dsl check, that if the name is a dsl, then get by dsl than deprecating it.
I don’t quite understand why you can’t remove the name since it just does a subset of what dsl already does.
Did you see my comment? Also, I’m worried about what you have done based on your change to the ticket title. This wasn’t just about what the first argument accepted, this was about simplfying all the arguments to make positioanl arguments better. One of the goals of this ticket is to be able to do this:
If all you did was leave both name and dsl but made name more flexible, then this ticket is not complete.
That’s a good point. I didn’t read that part. I will reopen and addresss