gleam icon indicating copy to clipboard operation
gleam copied to clipboard

Add info about named accessors having priority over module function calls

Open inoas opened this issue 2 years ago • 2 comments

see: https://gleam.run/book/tour/modules.html vs https://gleam.run/book/tour/custom-types.html?highlight=named%20access#named-accessors

request.put_header("content-type", "application/json")

versus

request.some_member

inoas avatar Jan 17 '22 13:01 inoas

Sorry @inoas , what do you mean?

lpil avatar Jan 17 '22 16:01 lpil

Based on recent experience, in the following situation:

  1. A module and variable share the same name, and
  2. That variable references a non-opaque record with a field that shares a name with a function in the record's module

The variable.field accessor shadows the module.function call.

tynanbe avatar Jan 17 '22 17:01 tynanbe