gee, Aaron. that’s cute!

 

>> , this means you can do anything you damn well please with it. Anything.

 

it’s taken me while to appreciate this fact!

 

cheers

barry.b

 


From: Aaron DC [mailto:[EMAIL PROTECTED]
Sent: Thursday, 22 April 2004 10:28 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: CF version of VB's "WITH" ?

 

Hi Barry

 

I programmed in Dataflex for a couple of years, many moons ago, and love Cold Fusion for exactly the same reason: it is an interpreted language. Basically, this means you can do anything you damn well please with it. Anything. I whipped this up after you posed the question, tested it and it works. You can play with it to your heart's content to make it more robust - I only put one check in (to make sure it's an assignment statement).

 

File: with.cfm

==========

<CFIF thisTag.ExecutionMode EQ "End">
    <CFLOOP Index="Line" List="#thisTag.GeneratedContent#" Delimiters="#Chr(13)#">
        <CFSET Line=Trim(Line)>
        <CFIF Find("=", Line) GT 0>
            <CFSET junk = Evaluate("Caller.#Attributes.Var##Line#")>
        </CFIF>
    </CFLOOP>
    <CFSET thisTag.GeneratedContent = "">
</CFIF>

Example usage:

============

<CFSET test = StructNew()>
<CF_With Var="test">
    .ele1 = "hello"
    .ele2 = "there"
    .ele3 = "thexthy"
</CF_With>         
        

Possible enhancement ideas:

1. change delimiters to #Chr(13)# & ";" and then you could have .ele1 = "hello";.ele2="there"; etc etc

2. make the tag recursive or handle nested calls and you could nest <CF_with ...> constructs


HTH
Aaron

 

 

----- Original Message -----

 

does CF (maybe within CFSCRIPT)  have something like VB’s WITH keyword when working with object methods and properties?

 

eg:

 

WITH myObject

            .val1 = var1

            .val2 = var2

            .addnew()

END WITH

 

 

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to