NethermindEth / cairo-vm-go

A virtual machine for Cairo written in Go
MIT License
70 stars 43 forks source link

GetVariableAs methods in Scope #448

Open cicr99 opened 3 weeks ago

cicr99 commented 3 weeks ago

Currently in the scope file, there is a method for getting a variable from the scope directly as a BigInt and in PR#361 another is being added for uint64. It would be nice to have more functionalities like this for other types, specially for the ones that repeat the most such as Element for handling felts

MukulKolpe commented 3 weeks ago

Hey @cicr99, can I work on this issue?

cicr99 commented 3 weeks ago

Sure @MukulKolpe Pls notice that for this PR, besides creating the requested functions, you'll also need to modify the places in the code where this logic is used and replace it with the functions you created

MukulKolpe commented 3 weeks ago

Sure @cicr99, thank you for the heads-up. I'll make sure to modify all the parts of the code where this logic is used.

TAdev0 commented 3 weeks ago

@MukulKolpe please wait a bit before working on it so that we can discuss it tomorrow with the team. It seems using generics might be a good idea here as proposed @danielcdz in https://github.com/NethermindEth/cairo-vm-go/issues/347

MukulKolpe commented 3 weeks ago

@TAdev0, Okay, that makes sense. Thanks for informing me. Let me know what the team decides.

TAdev0 commented 3 weeks ago

@MukulKolpe will make a few tests to see whether using generics decreases efficiency or not , to know if we should them or implementing type by type getVariableAs functions

danielcdz commented 3 weeks ago

Great!