Is there documentation on Lucee's shortcut script ...
# lucee
b
Is there documentation on Lucee's shortcut script property syntax, where you can do
Copy code
property myProp;
as opposed to
Copy code
property name="myProp";
I'm having a terrible time finding actual docs for it, and I'm unclear on what attributes like
default
or the type are allowed and what that syntax looks like.
As best I can tell from a bunch of experimentation, it's
Copy code
property <name>;
property <type> <name>;
or
property <key=value...> <type> <key=value...> <name> <key=value...>;
where
key=value
can actually just be
key
where the value is defaulted to an empty string. And in the last example •
type
is the first key without a value •
name
is the second key without a value if there are more than one keys without values. Otherwise, if there is only one key without a value,
name
is simply the first one.
Ex: given
Copy code
property sdfsdf=fsdf first qwer=qwer second yuio=yuio third;
The
type
is "first", the
name
and "second", and all others become arbitrary metadata.
image.png
r
The docs I've ever found on this subject has been this from Adam - https://github.com/adamcameron/cfscript/blob/master/cfscript.md#properties
šŸ‘ 1
d
Does the old metadata syntax work: /* @type string @getter false */ property name; (Or whatever the syntax was, I kinda forget)
b
@dswitzer Hmm, sort of, but not really
It seems I can set arbitrary metadata, but not actually affect the property itself
Copy code
/**
     * My hint
    * @type string
    * @getter false
    * @default my Default val
    * @random does this work?
    */
    property name;
image.png
d
I'm pretty sure that used to work in ACF, but I've never tried it with Lucee and it's been years since I used the syntax in ACF.
b
So the hint pulled in and stuff like
random
. Type and default however was ignored.
I would guess Lucee doesn't support getter so it falls in the category of random arbitrary keys?
Support for custom annotations, whether "inline" or in a javadoc style comment is a bit of a "wild west" when it comes to engine support. neither engine really even documents what they support.
d
The Lucee docs do indicate that getter/setter should be supported: https://docs.lucee.org/reference/tags/property.html
šŸ‘ 1