How to refer to sibling variable value ?

Albert Kam <[email protected]> Wed, 11 Nov 2015 11:45:09 +0700
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAMT20g9LYF9MbosDNZg6RtvjYehuiqwZmUCt=kgZCzhvAc-buw@mail.gmail.com>
--===============8658765455345334263==
Content-Type: multipart/alternative; boundary=001a113a0868be324805243c7d80

--001a113a0868be324805243c7d80
Content-Type: text/plain; charset=UTF-8

I couldnt access sibling value from within nested hash item definition.

Non-working example:

<#assign parent={
    'sibling1': 'sibling 1',
    'sibling2': sibling1 + ' sibling'
}>

or

<#assign parent={
    'sibling1': 'sibling 1',
    'sibling2': parent.sibling1 + ' sibling'
}>

I had to reserve to a variable outside the hash definition to work:
<#assign val='sibling 1'
    parent={
        'sibling1': val,
        'sibling2': val + ' sibling'
    }
>

Is there a way to refer to sibling value from a hash item definition ?

-- 
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

--001a113a0868be324805243c7d80
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I couldnt access sibling value from within nested hash ite=
m definition.=C2=A0<div><br><div>Non-working example:</div><div><br></div><=
div>&lt;#assign parent=3D{</div><div>=C2=A0 =C2=A0 &#39;sibling1&#39;: &#39=
;sibling 1&#39;,</div><div>=C2=A0 =C2=A0 &#39;sibling2&#39;: sibling1 + &#3=
9; sibling&#39;</div><div>}&gt;<br clear=3D"all"><div><br></div><div>or</di=
v><div><br></div><div><div>&lt;#assign parent=3D{</div><div>=C2=A0 =C2=A0 &=
#39;sibling1&#39;: &#39;sibling 1&#39;,</div><div>=C2=A0 =C2=A0 &#39;siblin=
g2&#39;: parent.sibling1 + &#39; sibling&#39;</div><div>}&gt;<br clear=3D"a=
ll"></div></div><div><br></div><div>I had to reserve to a variable outside =
the hash definition to work:</div><div>&lt;#assign val=3D&#39;sibling 1&#39=
;</div><div>=C2=A0 =C2=A0 parent=3D{<br></div><div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 &#39;sibling1&#39;: val,</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &=
#39;sibling2&#39;: val + &#39; sibling&#39;</div><div>=C2=A0 =C2=A0 }</div>=
<div>&gt;<br clear=3D"all"></div></div><div><br></div><div>Is there a way t=
o refer to sibling value from a hash item definition ?</div><div><br></div>=
-- <br><div class=3D"gmail_signature">Do not pursue the past. Do not lose y=
ourself in the future. <br>The past no longer is. The future has not yet co=
me. <br>Looking deeply at life as it is in the very here and now, <br>the p=
ractitioner dwells in stability and freedom.<br>(Thich Nhat Hanh)</div>
</div></div></div>

--001a113a0868be324805243c7d80--


--===============8658765455345334263==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------

--===============8658765455345334263==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user

--===============8658765455345334263==--