?. safe navigation operator

Description

Copied from https://issues.jboss.org/browse/RAILO-2580

See http://cfmlblog.adamcameron.me/2013/08/thinking-about-operators-in-cfml.html
This is best demonstrated with an example:

a = { b = { c = { d = 1 } } }; writeOutput(a?.b?.c?.d); // 1 writeOutput(a?.e?.c?.d); // null writeOutput(a.e.c.d); // ERROR

So rather than erroring because a.e doesn't exist, it gracefully returns null. Nice. This saves a lot of sequential structKeyExists() calls, or (grim) an isDefined() call.

Activity

Adam Cameron 24 September 2021 at 13:14

:-|

I am not making this observation for the sake of pointing out missing docs.

I’m pointing it out BECAUSE I NEED TO READ THE DOCS.

Saying “feel free to add something” is not helpful, and something I had hoped LAS people had moved on from.

You should be documenting yer own features as part of implementing them. This should not have been released without docs. However you are where you are, that’s cool, but a more reasonable reaction here might be “oh yeah, we forgot. I’ll get a ticket in to get that sorted out. Thanks for bringing it to our attn. In the mean time, [here’s how it works]”.

Andrew Dixon 24 September 2021 at 12:35

I guess it should be here https://docs.lucee.org/guides/developing-with-lucee-server/operators.html but has never been added. Feel free to add something.

Adam Cameron 24 September 2021 at 12:26

Where are the docs for this? Can’t find anything in the docs when googling for “lucee safe navigation operator”

Jesse Shaffer 16 February 2016 at 20:55

now that cf2016 has landed with this operator, this issue probably ought to have a higher priority

Fixed

Details

Assignee

Reporter

Labels

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Fix versions

Affects versions

Priority

Created 1 February 2015 at 16:36
Updated 24 September 2021 at 13:14
Resolved 8 June 2016 at 05:49