onflow / cadence

Cadence, the resource-oriented smart contract programming language 🏃‍♂️
https://cadence-lang.org
Apache License 2.0
534 stars 138 forks source link

Improve documentation #959

Open turbolent opened 3 years ago

turbolent commented 3 years ago

Various topics should be added or improved:

Tasks:

Todos:

rheaplex commented 3 years ago

It may be worth explicitly noting that return values are copied.

I have an example for that here:

https://play.onflow.org/5cff15ee-7aaf-497e-af8a-1cf8b3fdc11e?type=tx&id=6018d1ce-e19a-48c8-bd3e-376565c64e22

rheaplex commented 3 years ago

And here's an example for the pub const gotcha:

https://play.onflow.org/3ca9083a-4662-48ec-8211-c636ac25e88d?type=account&id=0

bluesign commented 3 years ago

On the access control page, add "Remember that if you can access a let dictionary or array you can mutate its contents, this includes when they are pub or access(all) member variables of a contract, resource or struct."

turbolent commented 3 years ago

@rheaplex It's documented that it's pass-by-value, but we should make that more prominent / add it as an example / detail, agreed 👍

turbolent commented 3 years ago

@rheaplex also, @bluesign had the great idea to report a warning, I've opened onflow/cadence-tools#429 for that