Add env.me() alias for env.current_contract_address()#1777
Add env.me() alias for env.current_contract_address()#1777leighmcculloch wants to merge 4 commits intomainfrom
env.me() alias for env.current_contract_address()#1777Conversation
|
In my mind "me" refers to a person. Not a native speaker but I think we should consider another more neutral word like "this" or just "contract". |
|
Maybe we can find a better term that's easier understand regardless of whether someone is a native speaker or not. Here examples of what the same or similar function is named in other contract system:
|
|
Oh nice table!
|
|
Came here to say what tupui is saying. My vote is |
|
|
I think env.address() is rather confusing. Something like |
|
Yeah but I think here you might have a bias of knowing too much about intervals 😅 If not for the contract address, I am not sure what else |
|
I'm starting to get a good sense of how we ended up with the current function. I'm closing this pull request. There's an issue open at #1778. If anyone thinks of better fn names, post it there please. |
What
Add
me()as an#[inline(always)]alias forcurrent_contract_address()onEnv. Both methods include cross-reference documentation linking to each other. A test verifies that both methods return the same address.Why
current_contract_address()is verbose for a frequently used call.me()provides a shorter, more readable alternative at no cost. Typically we'd avoid having two ways to do something in the SDK, but there's no reason to mark the longer fn as deprecated so this change does not do that.Close #1778