# What is a 'variable initialization expression'?

**URL:** <https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132>\
**Category:** Using Swift\
**Created:** [September 16, 2021, 3:21pm UTC](https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132 "2021-09-16T15:21:29Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Nevin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/nevin/32/617_2.png) [@Nevin](https://forums.swift.org/u/Nevin)\
**Post date:** [September 18, 2021, 4:37pm UTC](https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132/9 "2021-09-18T16:37:40Z")

</div>

I’d just like to reference the [acceptance notes for SE–0242](https://forums.swift.org/t/se-0242-synthesize-default-values-for-the-memberwise-initializer/20618/98):

> [@SE-0242: Synthesize default values for the memberwise initializer](https://forums.swift.org/t/se-0242-synthesize-default-values-for-the-memberwise-initializer/20618/98):
>
> The proposal review also discussed an interesting behavioral quirk with initial values and side-effects, for example:
> 
> ```swift
> struct Foo {
> var i: Int = getDefaultValue()
> }
> 
> struct Bar {
> var i: Int = getDefaultValue()
> init(i: Int) { self.i = i }
> }
> 
> let x = Foo(i: 1) // No side effects
> let y = Bar(i: 1) // Yes side effects
> 
> ```
> 
> The Core Team felt that this was a bug in the compiler's implementation of initializers. The failure here is that Bar calls the side effect, and it is not the right behavior. Addressing this would likely require an evolution proposal, or at least an assessment of whether or not fixing this would break existing code.

---

_[View the full topic](https://forums.swift.org/t/what-is-a-variable-initialization-expression/52132)._
