Skip to content

Commit

Permalink
docs: Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmenzel committed Jun 7, 2024
1 parent 024015c commit abe39cc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions architecture-decisions/2024-06-06_arc4-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Algorand TypeScript defines all types specified by ARC4 and their in memory repr

Pros:
- Zero cost decoding of ABI args (other than packed args for methods using more than 15 arguments)
- When storing a value in global/local/box storage - the binary format is already well defined by arc4
- When storing a value in global/local/box storage - the binary format is already well-defined by arc4

Cons:
- Contracts that frequently mutate dynamic structs will consume a large op code budget
Expand All @@ -47,8 +47,8 @@ Pros:
- In memory representation can be optimised

Cons:
- If Algo TS adds a new type not in ARC4, will it surprise users to see this not work?
- In some scenarios a value may be unnecessarily decoded and re-encoded when it could have been passed through untouched.
- In some scenarios a value may be unnecessarily decoded and re-encoded when it could have been passed through untouched.
- A number of types defined by ARC4 do not make sense to implement natively (eg. UFixedNxM) as the avm has no support for decimal math.

### Option 3 - Implement 'native' types which make sense + implement a full set of ARC4 types

Expand All @@ -60,11 +60,12 @@ Pros:
- Zero cost decoding of ABI args available as an option. (by opting to use the arc4 type)
- "native" types can be used in ABI args and the compiler will automatically decode them
- Arc4 types can optionally be used as a serialization format for box/global/local storage
- Developer has control to choose the solution which works best for their scenario rather than having one prescribed by the compiler


Cons:
- Several types will exist twice (string/uint64/bool etc) and this could be confusing to new developers who aren't fully across arc4
-
- Developer will need to be aware of arc4 encoding/decoding and the implications of it.

## Preferred options

Expand Down

0 comments on commit abe39cc

Please sign in to comment.