how to extend map interface for hashmap in vlang? #13538
Replies: 3 comments 10 replies
-
Maybe you have misunderstood the idea of Interface in V or Go. |
Beta Was this translation helpful? Give feedback.
-
V's maps are already hashmaps - all keys are hashed using wyhash. |
Beta Was this translation helpful? Give feedback.
-
Maybe "type alias" for that purpose? struct Foo{
x int
}
type MyFoo = Foo
fn (mf MyFoo) add() int{
return mf.x + mf.x
}
fn main(){
f := Foo{3}
// dump(f.add()) error
mf := MyFoo{3}
dump(mf.add())
}
Well, but if I were you, I'd use the embedding. |
Beta Was this translation helpful? Give feedback.
-
how to extend map interface for implementing hashmap in vlang?
do vlang have some tutorials for it ?
Beta Was this translation helpful? Give feedback.
All reactions