On Tuesday, September 17, 2002, at 09:18 , Dick Applebaum wrote:
> But, if the problem is caused by lack of typing, it seems to me that
> this is something MM can fix rather easily by allowing type definition
> by those who want to do it, and generating efficient code if it is
> present or use the current generation if it is not.

Not "easily", no. Adding type specifications to a type-less language - 
especially *optional* type specifications - complicates the compiler to 
quite a degree. Every reference to a variable has to be checked for known 
type information and, if present, either generate the appropriate code or 
warn of inappropriate usage. (If not present, it generates the same code 
as now). Read that carefully: *every* reference. That potentially impacts 
a lot of places in the code generator.

> I think that CF would lose little and gain quite a lot if it allowed an
> optional type definition.

I agree that being able to declare types in CF would be a nice enhancement.
  But it would be a major change to the language.

> Think of it as extending the reach of CF to places it could not go
> before.

And then folks will want bitwise operations and full Java expression 
syntax inside cfscript! :)

> BTW, nulls should also be allowed in CF!

Hah! Adding 'null' to a language that doesn't currently support it is a 
*major* change and it's mostly a run-time change. It would cause a huge 
ripple through the CF language to add null because the semantics need to 
be defined (in documentation!) and it could impact every single expression 
in the language. Consider isStruct() - should isStruct( null ) return 
false or should it just fail with a null pointer exception (which is what 
happens now if you manage to feed it a null). What about isDefined()? 
Right now, if you manage to create a struct key entry with a null value, 
isDefined( "str.key" ) is false but structKeyExists( str, "key" ) is true.
  In fact isDefined( "v" ) is false whenever either 'v' is not declared *or*
  it has a null value.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to