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

Konstante #97

Closed
NotLe0n opened this issue Nov 13, 2024 · 0 comments · Fixed by #112
Closed

Konstante #97

NotLe0n opened this issue Nov 13, 2024 · 0 comments · Fixed by #112
Assignees

Comments

@NotLe0n
Copy link
Member

NotLe0n commented Nov 13, 2024

Soll das Feature ein Problem lösen?
Wenn man eine Bibliothek schreibt muss man manchmal Werte öffentlich machen, die der Nutzer nicht verändern darf. Zum Beispiel IDs oder Flags.

Alternativen
Natürlich könnte man eine Funktion machen, die einen konstanten Wert zurück gibt, jedoch würde das drei Zeilen pro Konstante brauchen.

Das Feature
Eine neue Deklaration um Konstante zu deklarieren.

Syntax Vorschlag
Man könnte, wie in anderen Sprachen, das Wort "konstant" an eine Variablendeklaration anhängen: Die konstante Zahl foo ist 5..

Da der Wert auf der rechten Seite jedoch konstant sein muss, ist es nicht nötig einen Typ anzugeben.

Die Konstante foo ist 5.

Ein bonus: Damit verhindert man diese wiedersprüchliche Deklaration: Die konstante Variable ....

@NotLe0n NotLe0n self-assigned this Feb 3, 2025
@NotLe0n NotLe0n mentioned this issue Feb 3, 2025
@NotLe0n NotLe0n linked a pull request Feb 3, 2025 that will close this issue
@NotLe0n NotLe0n closed this as completed Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant