----- Original Message -----
From: "Raymond Camden" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, March 23, 2004 11:19 AM
Subject: RE: Dots in variable names behaving unexpectedly

> > Can someone give me the lowdown on why...
> > registrant.emergencyPhone.Phone.countryCode = 1; ...is
> > equivalent to...
> > registrant["emergencyPhone"]["Phone"]["countryCode"] = 1;
> >
> > Is this new in CFMX? I used to name variables with dots in
> > them to sort of give pseudo-scopes to groups of variable.
> > Maybe it's always behaved this way, but I never had occasion
> > to dump one?
>
> Yes, it is new to CFMX. However, it has _always_ been bad practice
(imho) to
> create variables like this. I always suggest folks go through the
trouble
> of:
>
> <cfset registrant = structNew()>
> <cfset registrant.emergencyPhone = structNew()>
> etc

In CF5, if not setting (sub)structs like this, i.e.

<cfset registrant = structNew()>
<cfset registrant.emergencyPhone.countrycode = "1">

What kind of variable is "emergencyPhone.contrycode"?  Has CF created a
struct at that level or is it just a variable with a period in its name?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to