Thanks, David, great point about referencing the result multiple times.

I just thought to myself : "Damn, I'm good" when I "discovered" this.

----- Original Message -----
From: Dave Watts
To: CF-Talk
Sent: Monday, December 29, 2003 1:58 PM
Subject: RE: Is this valid syntax for accessing CFFUNCTION return

> If a function returns a complex data type as a result, say a
> struct, can I shorthand it like this?
>
> <cfset myVar = myFunc().struct_key>
>
> That is, I've tested this to work, but I want know if this is
> the "official" behavior.

I don't really know if I'd call it "official", but it it well-known enough
that Sean Corfield recommends it for initializing CFC instances. So I
wouldn't expect it to disappear any time soon.

Of course, you wouldn't want to perform unnecessary work at runtime, so if
you plan to use the return value of the function repeatedly you're better
off putting it into a variable.

Dave Watts, CTO, Fig Leaf Software
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to