Mark Stanton wrote:
Barry

I think the point is that I can do:

<cfset someObject = createObject('component','com.gruden.someObject')>

<cfset arg1 = "argument 1">
<cfset arg2 = "argument 2">
<cfset arg3 = "argument 3">

<cfset args = structNew()>
<cfset args.arg1 = arg1>
<cfset args.arg2 = arg2>
<cfset args.arg3 = arg3>

And...
<cfset foo = someObject.bar(argumentsCollection=args)>
<cfset foo = someObject.bar(arg1, arg2, arg3)>
<cfset foo = someObject.bar(arg1=arg1, arg2=arg2, arg3=arg3)>

...will all do the same thing. But if I have a call to super.bar()
within the someObject.bar() I don't have this flexibility. I can ONLY
use the:

<cfset super.bar(arg1, arg2, arg3)>

..syntax.


Yes but in "other" languages you can overload the methods, in that based on the arguments you feed it can carry out specific tasks.

I think the reason why it does what it does above, is once it compiles down to java, you kind of now live and die by what java itself allows you to. I'm not even sure, you can use argu1=arg2 even in java? (could someone look that one up or advise as i am really curious as to if you can).

I ask this as I'm under the opinion that Java is strictly positioned (ie same order as the function dictates).

If you want to setup a scenario were you have optional arguments in the ordering then you could *be careful* use a method wrapper for this

function methodX(arg1,arg2,arg3,ag4) {
        if(arguments.length = 3) {
                methodX_3args(arg1,arg2,arg3);
        
        }
        etc..
}

But not sure how or why this would be effective in CFMX. Its a cumbersome OO language in many forms as its really a big ass facade around a nice and complex language, so try not to punish it for allowing you to be spoon feed java byte code :D


Scott.





Its a matter a of consistency in the language. Debates about which method of passing arguments is better practice are not relevant to this thread.


--- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to