struct{init-name-binding} {{init-name-binding}}

An anonymous structure expression is a syntactic sugar to combine Anonymous Structure Type with its Init Statement using the name binding. However, it is not possible to make an empty anonymous structure expression. Types in Nu are value so it would be impossible to differentiate anonymous structure expression and anonymous structure type.

Example:

// code for example, not 100% valid

astruct := struct{a, b int}{*a: 18, *b: 24} 
// anonymous structure with init expression using name binding

sugar := struct{*a: 18, *b: 24} // anonymous structure with syntactic sugar

There are two syntax to make anonymous structure. The one with the full keyword struct and another one with only {{ and a closing }}.

astruct1 := struct{*a: 42, *b: 54}
astruct2 := {{*a: 42, *b: 54}} // = astruct1

Since anonymous structure expression, are basically the init with name binding, the same rules apply:

var a = 42, b = 53, c = 67

astruct1 := {{*a, *b, *c}} 
// <=> {{*a: a, *b: b, *c: c}}
// <=> struct{a, b, c int}{*a, *b, *c}

astruct2 := {{a: 16, *astruct1...}} 
// <=> {{a: 16, b: astruct1.b, c: astruct1.c}}
// <=> struct{a, b, c}{*a: 16, *astruct1...}

astruct3 := {{*lstruct1}} 
// <=> {{lstruct1: lstruct1}}
// <=> struct{lstruct1 struct{a, b, c int}}{*lstruct1}

There is more about binding on Bindings chapter.