Hacker News new | ask | show | jobs
by SeekingMeaning 2243 days ago
I really love the syntax, especially the dereference operator being the @ symbol and the usage of val vs var for constants/variables. (For context, I started off with Java and prefer writing in Kotlin nowadays.) Compared to languages like Zig or V, I think you strike a pretty good balance between being familiar and introducing new/different syntax.
1 comments

Just curious: why might @ be preferred over &?
& isn't even the dereference operator, right? That's what gives you the pointer. * gives you the value at the pointer. I guess that's why it's preferable, in English it reads nicely and describes exactly what it does. `val arg = @(argv + 1)` reads like "val arg is the value at argv + 1"
I always read & as "at" mentally when reading code :)
I read it as "address of" but @ definitely works if we are talking about an address. The value is @x
whoops you are correct. interesting, thanks
As anecdote, my brain parses it more easily because I read "at", so I automatically interpret the expression as an address. Like "get the value at argv+1"