clarity-lang / reference

The Clarity Reference
149 stars 34 forks source link

Rename define-map to avoid confusion with map #37

Open njordhov opened 3 years ago

njordhov commented 3 years ago

The define-map syntactic form defines associative persistent state, but the name can be confusing given the map function and the more general concept of a map datastructure.

Renaming define-map and its related functions (map-delete map-get? map-insert map-set) will avoid the confusion, as in:

define-table table-delete table-get? table-insert table-set or define-state state-delete state-get? state-insert state-set

njordhov commented 3 years ago

Now is an opportune time to change the naming, given the breaking changes to define-map in https://github.com/blockstack/stacks-blockchain/pull/2115

friedger commented 3 years ago

I like table as a similar concept to var that builds the state of the contract

lgalabru commented 3 years ago

I like data-map and its consistency with data-var.

njordhov commented 3 years ago

I like data-map and its consistency with data-var.

The word data is a bit redundant in both, though, to the point of being nearly meaningless.

friedger commented 3 years ago

I like data-map and its consistency with data-var.

with data-map with have map-get, like we have var-get. Does not change confusion with map function.

njordhov commented 3 years ago

I like data-map and its consistency with data-var.

@lgalabru Does your liking of the term data here have to do with that both defines persistent data aka state?

lgalabru commented 3 years ago

I'd like define-state-map / define-state-var equally, so it's really about consistency between these 2 concepts.