microsoft / qsharp-language

Official repository for design of the quantum programming language Q# and its core libraries
MIT License
233 stars 54 forks source link

Clarify evaluation semantics of repeated constant arrays #129

Open bamarsha opened 2 years ago

bamarsha commented 2 years ago

QEP 2 adds the [x, size = n] expression. However, it doesn't specify whether the expression x should be evaluated once and its result copied to every element, or if x should be evaluated n times.

The spec should be clearer about the evaluation semantics of repeated constant arrays. I would prefer to use the semantics that x is evaluated once.

bettinaheim commented 2 years ago

I thought we had captured that in the proposal - I remember discussing it. The expression should be evaluated exactly once, independent on the size of the array (specifically also for size 0).