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

  • Soviet Pigeon@lemmygrad.ml
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    edit-2
    7 months ago

    but Im seeing syntax that Ive never seen in my life

    Which languages do you know? What is your background?

    What is wrong with “var test int”? There is no need for a return type, if the function returns nothing. Thats the language design and I think it is easy to remember.

    func(u User) hi ()

    u is something like self in Python and hi() is a method of User.

    Please explain why do you think something is too messy, also with which languages you have already worked.