nimskull icon indicating copy to clipboard operation
nimskull copied to clipboard

do node consistency

Open krux02 opened this issue 2 years ago • 3 comments

do nodes are now consistently lambda expressions no matter if they have arguments or not. stmtLists are no longer lifted implicitly to lambda expressions

Summary

  • do nodes without arguments are not implicitly converted to bare stmtList anymore.
  • bare stmtList is not lifted to a lambda expression anymore.
  • The behavior that got removed was a hack that cause more problems than it solved.

Details

It caused problems in my macro library, especially the implicit lifting of stmtList to a λ expression is a liability that is really hard to work around. It is not a feature to be proud upon. It is a breaking change, especially cases when do blocks need to be treated as bare stmtList and not λ expressions.


This is a change I've made a long time ago on my own fork of Nim.

krux02 avatar Apr 16 '22 18:04 krux02

@haxscramper the code I broke is mostly code you wrote, so I would really like to hear your opinion about it.

krux02 avatar Apr 16 '22 18:04 krux02

Can you provide an example for the behavior change?

alaviss avatar Apr 16 '22 18:04 alaviss

This video from racket conf offers a better solution for alternatives and handling multiple groups to be associated with a previous line: https://youtu.be/UUWYTW3Xck8

Preview:

foo(stuff):
  | One statement
    Still part of one statement
  | Second statement, both one and two are arguments to foo

Without something as the above we can't move forward with this do change.

saem avatar Jul 05 '22 00:07 saem

This has gone stale and the multiple statements via pipes is required first. It can be resurrected if and when needed.

saem avatar Nov 21 '22 17:11 saem