Re: chain variable setting

2010-03-01 Thread Barney Boisvert

A quick test indicates it's new in CF9.  Worth mentioning that it is
NOT treating the assignment as an expression, it is only allowing
multiple variables to be assigned to a single expression.  Your second
test case would fail regardless of which one CF was doing, but this
example also fails (meaning it's the latter):

cfset c=(b=a+1)+1

You can also use assignments in loop conditions.  I think Ben blogged
about that last summer.

cheers,
barneyb

On Mon, Mar 1, 2010 at 1:33 PM, Michael Dinowitz
mdino...@houseoffusion.com wrote:

 I think that I missed this in the docs. It seems that you can chain
 set variables

 cfset a=1
 cfset c=b=a+1

 This will give you a=1, b=2, c=2.

 On a related note, the following will fail

 cfset a=1
 cfset c=b+1=a+1

 The chain works as long as there is no operation except on the
 right-most item in the chain.

 This is all expected behavior in some other languages but I've never
 seen it in CF. Anyone know when it was added?

 Please make me look like a fool for missing it. :)

 --
 Michael Dinowitz




-- 
Barney Boisvert
bboisv...@gmail.com
http://www.barneyb.com/

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331227
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: chain variable setting

2010-03-01 Thread Eric Roberts

6.1 doesn't like it...

Eric

-Original Message-
From: Michael Dinowitz [mailto:mdino...@houseoffusion.com] 
Sent: Monday, March 01, 2010 3:33 PM
To: cf-talk
Subject: chain variable setting


I think that I missed this in the docs. It seems that you can chain
set variables

cfset a=1
cfset c=b=a+1

This will give you a=1, b=2, c=2.

On a related note, the following will fail

cfset a=1
cfset c=b+1=a+1

The chain works as long as there is no operation except on the
right-most item in the chain.

This is all expected behavior in some other languages but I've never
seen it in CF. Anyone know when it was added?

Please make me look like a fool for missing it. :)

--
Michael Dinowitz



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331228
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: chain variable setting

2010-03-01 Thread Michael Dinowitz

I've just run a regex against the cfdocs and I can't find any
reference to this new chaining functionality. This implies it's a new
and overlooked functionality. I wonder what else is un-noted.

Assignments in loop conditions has been around for a while. If it's a
CFLoop then you can only alter the loop operation with a condition. If
it's a loop within a script, you can use assignments at any time. It
allows for some 'silly' effects like this:

CFSCRIPT
 For (i=M;i NEQ P; i=Chr(Asc(i)+1))
  writeoutput(i' ');
/CFSCRIPT



On Mon, Mar 1, 2010 at 4:40 PM, Barney Boisvert bboisv...@gmail.com wrote:

 A quick test indicates it's new in CF9.  Worth mentioning that it is
 NOT treating the assignment as an expression, it is only allowing
 multiple variables to be assigned to a single expression.  Your second
 test case would fail regardless of which one CF was doing, but this
 example also fails (meaning it's the latter):

 cfset c=(b=a+1)+1

 You can also use assignments in loop conditions.  I think Ben blogged
 about that last summer.

 cheers,
 barneyb

 On Mon, Mar 1, 2010 at 1:33 PM, Michael Dinowitz
 mdino...@houseoffusion.com wrote:

 I think that I missed this in the docs. It seems that you can chain
 set variables

 cfset a=1
 cfset c=b=a+1

 This will give you a=1, b=2, c=2.

 On a related note, the following will fail

 cfset a=1
 cfset c=b+1=a+1

 The chain works as long as there is no operation except on the
 right-most item in the chain.

 This is all expected behavior in some other languages but I've never
 seen it in CF. Anyone know when it was added?

 Please make me look like a fool for missing it. :)

 --
 Michael Dinowitz




 --
 Barney Boisvert
 bboisv...@gmail.com
 http://www.barneyb.com/

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331229
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: chain variable setting

2010-03-01 Thread Judah McAuley

It was definitely added in CF9 but you are right, I don't see it
listed in What's New in Coldfusion 9. Curious.

This is the reference page for this particular functionality however:

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS328B9130-F922-4ddb-B78B-8817CA81F8E3.html

Cheers,
Judah

On Mon, Mar 1, 2010 at 2:02 PM, Michael Dinowitz
mdino...@houseoffusion.com wrote:

 I've just run a regex against the cfdocs and I can't find any
 reference to this new chaining functionality. This implies it's a new
 and overlooked functionality. I wonder what else is un-noted.

 Assignments in loop conditions has been around for a while. If it's a
 CFLoop then you can only alter the loop operation with a condition. If
 it's a loop within a script, you can use assignments at any time. It
 allows for some 'silly' effects like this:

 CFSCRIPT
     For (i=M;i NEQ P; i=Chr(Asc(i)+1))
          writeoutput(i' ');
 /CFSCRIPT



 On Mon, Mar 1, 2010 at 4:40 PM, Barney Boisvert bboisv...@gmail.com wrote:

 A quick test indicates it's new in CF9.  Worth mentioning that it is
 NOT treating the assignment as an expression, it is only allowing
 multiple variables to be assigned to a single expression.  Your second
 test case would fail regardless of which one CF was doing, but this
 example also fails (meaning it's the latter):

 cfset c=(b=a+1)+1

 You can also use assignments in loop conditions.  I think Ben blogged
 about that last summer.

 cheers,
 barneyb

 On Mon, Mar 1, 2010 at 1:33 PM, Michael Dinowitz
 mdino...@houseoffusion.com wrote:

 I think that I missed this in the docs. It seems that you can chain
 set variables

 cfset a=1
 cfset c=b=a+1

 This will give you a=1, b=2, c=2.

 On a related note, the following will fail

 cfset a=1
 cfset c=b+1=a+1

 The chain works as long as there is no operation except on the
 right-most item in the chain.

 This is all expected behavior in some other languages but I've never
 seen it in CF. Anyone know when it was added?

 Please make me look like a fool for missing it. :)

 --
 Michael Dinowitz




 --
 Barney Boisvert
 bboisv...@gmail.com
 http://www.barneyb.com/



 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331230
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: chain variable setting

2010-03-01 Thread Michael Dinowitz

Not only did I miss it, my regex didn't find it because it assumed a
cfset. There are a few things not mentioned in the what's new
section. This is only one of them. :(

--
Michael Dinowitz




On Mon, Mar 1, 2010 at 5:07 PM, Judah McAuley ju...@wiredotter.com wrote:

 It was definitely added in CF9 but you are right, I don't see it
 listed in What's New in Coldfusion 9. Curious.

 This is the reference page for this particular functionality however:

 http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS328B9130-F922-4ddb-B78B-8817CA81F8E3.html

 Cheers,
 Judah

 On Mon, Mar 1, 2010 at 2:02 PM, Michael Dinowitz
 mdino...@houseoffusion.com wrote:

 I've just run a regex against the cfdocs and I can't find any
 reference to this new chaining functionality. This implies it's a new
 and overlooked functionality. I wonder what else is un-noted.

 Assignments in loop conditions has been around for a while. If it's a
 CFLoop then you can only alter the loop operation with a condition. If
 it's a loop within a script, you can use assignments at any time. It
 allows for some 'silly' effects like this:

 CFSCRIPT
     For (i=M;i NEQ P; i=Chr(Asc(i)+1))
          writeoutput(i' ');
 /CFSCRIPT



 On Mon, Mar 1, 2010 at 4:40 PM, Barney Boisvert bboisv...@gmail.com wrote:

 A quick test indicates it's new in CF9.  Worth mentioning that it is
 NOT treating the assignment as an expression, it is only allowing
 multiple variables to be assigned to a single expression.  Your second
 test case would fail regardless of which one CF was doing, but this
 example also fails (meaning it's the latter):

 cfset c=(b=a+1)+1

 You can also use assignments in loop conditions.  I think Ben blogged
 about that last summer.

 cheers,
 barneyb

 On Mon, Mar 1, 2010 at 1:33 PM, Michael Dinowitz
 mdino...@houseoffusion.com wrote:

 I think that I missed this in the docs. It seems that you can chain
 set variables

 cfset a=1
 cfset c=b=a+1

 This will give you a=1, b=2, c=2.

 On a related note, the following will fail

 cfset a=1
 cfset c=b+1=a+1

 The chain works as long as there is no operation except on the
 right-most item in the chain.

 This is all expected behavior in some other languages but I've never
 seen it in CF. Anyone know when it was added?

 Please make me look like a fool for missing it. :)

 --
 Michael Dinowitz




 --
 Barney Boisvert
 bboisv...@gmail.com
 http://www.barneyb.com/





 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331231
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4