You don't need access to the CFML source code to see how strong typing can
benefit CF and how it can be implemented--only need to look at the Java
files generated by CFMX.
If you look at these files you'll see how all variable references go through
a complex set of Hashtable lookups, custom-casting functions, and
auto-scalarize functions. All this work on every variable reference is
waistful but necessary today given CF's loose nature.
The case is a little better for function-local variables as they don't have
the hashtable lookup (a var scope variable maps to a Variable class instance
in Java and are not stored in a Hashtable). However, these variables still
go through the same CF casting and auto-scalarize stuff.
If CF were to provide strong typed variables at a var-scope level (function
local only) then we wouldn't have variables stored as "Variable" class
instances but as native variables. We wouldn't have constant casting. We
wouldn't have scalarizing stuff.
Limiting it to var-scope only may seem insufficient but as more people start
to use CFC's for their entire app then this limitation becomes irrelevant.
CFC's can validate types coming in and out and if they can store them
natively, it would greatly improve performance and give us better
functionality and native Java integration.
Also take a look at what happens when you use a Java object in CF via
createObject or cfobject or getClass. All method calls on the java object
are routed through reflection which is a lot of complex code. If we had
variables strongly typed to java variables, then all this reflection could
be removed and we could directly program Java objects in CFML and achieve
speed in many cases similar to JSP for processor-intensive operations
(stream processing as the biggest issue where I've run into problems).
Best regards,
Sam
-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Friday, July 09, 2004 8:54 AM
To: CF-Talk
Subject: RE: Blackstone Strong Typing? was Re: CFX_FileReadLn
> Done right, CF doesn't need to give up anything to provide
> optional support for strong typing any more than they had to
> sacrifice anything to give us CFCs.
How do you know this?
We can all speculate on how easy or difficult something would be, but I find
it hard to reach this sort of conclusion without having access to the CF
source code.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

