Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arrays]: The OQ3 Spec refers to the term constructor but does not define what it means #449

Open
steleman opened this issue Feb 19, 2023 · 4 comments
Labels
clarify specification Change text of spec, not (mainly) semantics of spec

Comments

@steleman
Copy link
Contributor

steleman commented Feb 19, 2023

What is the expected enhancement?

The OQ3 Spec for Arrays contains the following statement:

The first argument to the array type constructor is the base type of the array.

constructors are associated with object-oriented programming languages:

https://en.wikipedia.org/wiki/Constructor_(object-oriented_programming)

The term constructor and its semantics are not defined in the current OpenQASM3 Spec. The OpenQASM3 Language does not support user-defined types.

Using constructors as means of instantiating object instances has consequences.

For starters, constructors assume a Memory Model, which OpenQASM3 does not have. Furthermore, the presence of constructors as means of instantiating objects implies the existence and definition of corresponding destructors.

If OpenQASM3 is to become an object-oriented language, then constructors and destructors should be fully defined in the Specification. If not, the reference to the term constructor should be removed from the Spec, because it refers to a non-existent language feature.

Side-note: arrays don't have constructors.

Also of concern is the reference - in the same sentence - to the concept of base type. That is, again, a concept borrowed from object-oriented languages. This concept assumes inheritance - single or multiple. The concept of inheritance is not defined in OpenQASM3, as it is not a supported feature of the language. The use of the term base type in the current Spec is confusing and misleading, and should be removed from the Spec.

@steleman steleman added the enhancement default GH label label Feb 19, 2023
@jwoehr
Copy link
Collaborator

jwoehr commented Feb 20, 2023

@steleman Can you submit a PR that would concisely make an appropriate modification to the spec to express things more rigorously as you indicate? Maybe the word declaration or declarator or something like that is better than constructor.

@steleman
Copy link
Contributor Author

Please see: #446

@blakejohnson
Copy link
Contributor

Re: "base type" I suggest that "element type" might be more accurate.

@blakejohnson
Copy link
Contributor

How about "type specifier" as a replacement for "type constructors" in the sentence referenced by Stefan?

@jlapeyre jlapeyre added clarify specification Change text of spec, not (mainly) semantics of spec and removed enhancement default GH label labels Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarify specification Change text of spec, not (mainly) semantics of spec
Projects
None yet
Development

No branches or pull requests

4 participants