Imagine an SES URL processor somewhat analogous to what Django
provides, with a regex match that captures specific segments of the
incoming URL and passes them to the requested method. Yes I know about
ColdCourse, and the related ColdBox plugin etc, I was just thinking
about alternate approaches.

So yes, maybe it's unusual, but not irrational, or due to lack of
structure in my code.

Please, can we not debate my motivation any more? If there are any
actual answers to the original question, I'd be interested in hearing
them, but frankly I doubt it. I've been doing CF for quite a while,
and didn't know of one, so I thought I'd ask around, but this keeps
focusing on "larger issues". That's a Good Thing in many cases, but
actually not here. I'm asking if there's a language feature I'm not
aware of to accomplish this, nothing more.

Dave


On Wed, Oct 6, 2010 at 1:34 PM, Michael Grant <mgr...@modus.bz> wrote:
>
> It's also pretty unusual to not have any idea how many arguments you are
> passing into a method. There are many more elegant approaches to your switch
> suggestion. The primary one being writing code that has structure and passes
> in the expected amount of arguments each time. Another one would be that
> since you know how many arguments you are expecting in the method perhaps
> write a function to loop over and pad your array with null values if they
> aren't defined. Then your call to the method can always pass in the expected
> amount of arguments.
>
>
>
>
> On Wed, Oct 6, 2010 at 1:13 PM, enigment <enigm...@gmail.com> wrote:
>
>>
>> It's unusual for a method to take an array of its arguments, rather
>> than individual ones. Situation is something like a dispatcher; the
>> methods already have defined arguments, say Widgets.search(widgetName,
>> widgetCategory, widgetID). It'd be pretty weird for it to take an
>> array containing those three arguments. The layer I'm talking about
>> wants to call that, but only has an array of argument values, in
>> order.
>>
>> Not to be cranky, but while there's room for debate on why I want to
>> do this, this isn't that conversation. If there's no more elegant
>> approach than the switch strategy I mentioned, I'll probably ditch
>> this entire route. I first wanted to check if anyone could think of a
>> way to accomplish this in the CFML language, out of curiosity and to
>> maybe learn something that might be useful some day, as well to get it
>> done -- there's lots of smart and experienced folks out there. I
>> didn't mean to discuss whether it's worth doing.
>>
>> Thanks,
>> Dave
>>
>> On Wed, Oct 6, 2010 at 12:42 PM, Michael Grant <mgr...@modus.bz> wrote:
>> >
>> > Dave,
>> >
>> > Why don't you just pass in the array?
>> >
>> > <cfset positionalArgs = ['foo', 'bar', 42] />
>> > <cfset myFunction(positionalArgs) />
>> > <cffunction name="myFunction">
>> > <cfargument name="positionalArgs" type="array">
>> > <cfloop from="1" to="#arraylen(positionalArgs)#" index="x">
>> >  <cfdump var="#x#: #positionalArgs[x]#"><br />
>> > </cfloop>
>> > </cffunction>
>> >
>> >
>> > On Wed, Oct 6, 2010 at 12:38 PM, enigment <enigm...@gmail.com> wrote:
>> >
>> >>
>> >> @Michael: What I'm looking for is the positional equivalent of
>> >> argumentCollection. If it wasn't for that, you'd think the same about
>> >> passing a structure of arguments -- any object you pass will be
>> >> treated as a single argument. But argumentCollection trumps that. I
>> >> even tried a structure with keys 1, 2, 3, and passing that as
>> >> argumentCollection (unnamed arguments appear inside the function as 1,
>> >> 2, and 3 if you dump arguments), no joy.
>> >>
>> >> @Jason: Clearly, calling a method three times, each time with one
>> >> argument, is very different than calling it once with all three. Say
>> >> they're search fields, lastName, FirstName, ZIP; you want the search
>> >> to run with all three of them in place, not separately for each one.
>> >> (Not sure why you went with an iterator rather than just indexing over
>> >> the array, but it doesn't matter, not what I need to do.)
>> >>
>> >> Thanks for the ideas though. This just may not be possible.
>> >>
>> >> Dav
>>
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337914
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to