CF8 Structure Literal Gotcha

This one has gotten me several times.  With the new structure literal notation in CF8, you have to use equal signs between the key-value pairs.  In other places where you use key-value pairs (like passing named params to a UDF), you can use equals signs or colons, but not so with structure literals.

I have to say, I was quite excited for structure and array literals in CF8, but man have I been disappointed.  No nesting cripples them to near worthlessness, and this (seemingly random) inconsistency adds further annoyance.  I'd have been happier if they'd just been omitted until they could have been done reasonably.

5 responses to “CF8 Structure Literal Gotcha”

  1. Chris Phillips

    I completely agree that they are crippled to near worthlessness.

    If I can't use them like the following, then what's the point?

    Struct = {'StructNotationInCF':{'HasTheFollowingProperties':["Can't be nested","Can't be used as function parameters","Really can't do much"]}};

  2. Joe Rinehart

    Sort of a useless comment, but I have to say…no nesting? WTF?

  3. tanguyr

    Hello Barney,

    Can you create a nested struct-equivalent in server side javascript and pass it back to the cf layer?

    Regs,
    /t

  4. Dan Wilson

    I imagine Adobe also realizes the uselessness of the feature without nesting. After all, plenty of programmers work on the CF team. Certainly they use complex data structures.

    I am looking for this to be fixed in a point release.