# Alternative declaration syntax

**URL:** <https://ziggit.dev/t/alternative-declaration-syntax/3218>\
**Category:** Brainstorming\
**Tags:** language\
**Created:** [February 11, 2024, 2:39pm UTC](https://ziggit.dev/t/alternative-declaration-syntax/3218 "2024-02-11T14:39:10Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![dee0xeed](https://ziggit.dev/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@dee0xeed](https://ziggit.dev/u/dee0xeed)\
**Post date:** [February 12, 2024, 12:59pm UTC](https://ziggit.dev/t/alternative-declaration-syntax/3218/23 "2024-02-12T12:59:18Z")

</div>

> [@korke](#):
>
> but i think even for variables you might want to see the type first to decide “is it the thing i care about”

This is about tokens order. I guess the reason why modern programming languages tend to use `fn/func/proc` for subroutines and `let/var whatever` for variables is quite “simple” - these “prefixing” keywords just make life more easy for compilers. If you see an `int` (I mean C), you do not know what will follow. If you see `var`, you definitely know what _should_ follow next.

Tokens order, tokens order… a ~~variable~~ data entity/data unit declaration include (generally) these components:

- keyword (`var` or `let` or…)
- name
- type
- properties/attributes
  - mutability
  - volatileness
  - kind of memory (CPU registers, progmem)
  - something else?..

- initializer
- separators (like `:` in Pascal, Zig and many other)

It seems very logical to have a keyword to be first elevent and an initializer to be the last one.  
Position of others may vary…

What is “better”,

```plaintext
data mut,reg ptr: * imm,progmem u8;
// mutable pointer in CPU register(s),
// pointing to immutable u8 in progmem

```

or

```zig
data ptr mut,reg : *u8 imm,progmem;

```

? I do not know 🙂

[Previous page](https://ziggit.dev/t/alternative-declaration-syntax/3218.md?page=1)
