Skip to content

user feedback: Rename lam to lambda and give the unit type a name #587

Description

@czepluch

Feedback from an interview with an experienced Solidity developer.

lam is the only abbreviated keyword; return, function, constructor, match, and default are spelled out.

A keyword-introduced lambda is easier to read than Rust's bar-delimited closures, and the keyword should be the recognizable word.

() for the unit type is a Rust convention that most Solidity developers do not know, and in Solidity brackets mean an argument list.

In the reentrancy example showcased in the playground, a nullary lambda returning unit is written lam () -> () { ... }.
The reviewer could not tell which () was the parameter list and which the unit type.

Current state: lam is a reserved word in src/Solcore/Frontend/Lexer/SolcoreLexer.hs.
The lambda result annotation is optional, so lam () { ... } already parses.
The unit type has no surface name; Hull and the specializer call it unit internally.

Proposed changes:

  1. Rename the keyword to lambda.
  2. Add unit as a surface name for the unit type, keeping () accepted.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions