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:
- Rename the keyword to
lambda.
- Add
unit as a surface name for the unit type, keeping () accepted.
Feedback from an interview with an experienced Solidity developer.
lamis the only abbreviated keyword;return,function,constructor,match, anddefaultare 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:
lamis a reserved word insrc/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
unitinternally.Proposed changes:
lambda.unitas a surface name for the unit type, keeping()accepted.