Skip to content

Commit

Permalink
docs/diary/2024-04-28-code-block-and-return.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Apr 27, 2024
1 parent f5c309d commit 74192d6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/diary/2024-04-28-code-block-and-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: code block and return
author: Xie Yuheng
date: 2024-04-28
---

关于 code block 与 return,我能想到下面几种设计方案:

- (1) 放弃 code block 作为 expression,直接模仿 JS 语法。

- (2) code block 作为 expression,此时不能用明显的 return,
应该设计为最后一个 expression 作为 implicit return value。
因为 return 与 early return 相冲突。
- 并且这里没有更好的语法关键词选择,
`yield` `give` 等等都不太好。

我选择方案 (2)。

0 comments on commit 74192d6

Please sign in to comment.