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

  • dudeami0@lemmy.dudeami.win
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 month 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”.

  • sping@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    30 days ago

    The more time I spend on Lemmy the more depressed I am about its potential.

    Stupid, wrong-headed comments get solid upvotes if they also hint at some popular sentiment. I even see comments that are literally unreadable nonsense get solidly upvoted, either by bots or by people who just like the vibe they feel from scanning it and don’t care that it’s gobbledygook. Some content makes me wonder if half of Lemmy is just LLMs barfing back and forth at each other.

    Then this post is heavily upvoted, even though it’s nothing more than “the syntax isn’t the same as the other language(s) I have seen, waaaaa!”. Is it just people like to see Go criticized? Because there are actual real issues that could be discussed.