odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.55k stars 570 forks source link

Add opaque to the list of keywords (if it is) #318

Closed Breush closed 5 years ago

Breush commented 5 years ago

This does not parse (syntax error):

package main

A :: struct {
    opaque : int,
}

main :: proc() {
}

What does opaque do? (Couldn't find documentation about it.)

If it is a keyword, add it to https://github.com/odin-lang/Odin/wiki/Keywords-and-Operators

vassvik commented 5 years ago

opaque is a recent addition that is used to create a type that is not read or writeable, which is useful to make typesafe handles,

Handle :: opaque i64;

This should indeed be added to the docs/tutorial.

Breush commented 5 years ago

Can we consider to change the syntax to #opaque?

gingerBill commented 5 years ago

opaque was experimental in the first place but I made it a keyword to make it similar to distinct which is also a keyword.