24
submitted 5 months ago by urska@lemmy.ca to c/programming@programming.dev

I understand Rust being type safe, but Im seeing syntax that Ive never seen in my life in Go which looks too messy

var test int < bruh what?

:=

func(u User) hi () { ... } Where is the return type and why calling this fct doesnt require passing the u parameter but rather u.hi().

map := map[string] int {} < wtf

you are viewing a single comment's thread
view the rest of the comments
[-] dudeami0@lemmy.dudeami.win 11 points 5 months ago* (last edited 5 months ago)

Yea this is just syntax, every language does it a little different, most popular languages seem to derive off of C in some capacity. Some do it more different than others, and some are unholy conglomerations of unrelated languages that somehow works. Instead of saying why is this different, just ask how does this work. It's made my life a lot simpler.

var test int is just int test in another language.

func (u User) hi () { ... } is just class User { void hi() { ... } } in another language (you can guess which language I'm referencing I bet).

map := map[string]int {} is just Map<String, Integer> map = new HashMap<>() in another (yes it's java).

Also RTFM, this is all explained, just different!

Edit: I also know this is a very reductive view of things and there are larger differences, I was mostly approaching this from a newer developers understanding of things and just "getting it to work".

this post was submitted on 13 Jun 2024
24 points (67.6% liked)

Programming

17314 readers
150 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS