gopherdata / gopherdata/gophernotes

notebook: defer is executed at the end of a cell

未关闭
#150 7 条评论 0 个 reaction 已指派 1 人 已被 @cosmos72 认领 在 GitHub 查看
limitation
主要语言
Go
星标
4k
派生
264
平均合并
7 天 21 小时
30 天内合并 PR
1

描述

hi,

I am converting a few neugram.io-based notebooks to gopherdata+gomacro.

In these neugram notebooks, a `defer` would only be executed at the end of the notebook, not at the end of the cell/block. _e.g._:

```
// cell-1
f, err := os.Open(fname)
if err != nil {
panic(err)
}
defer f.Close()
```
```
// cell-2
_, err = f.Write([]byte("hello"))
if err != nil {
panic(err)
}
```

this would work in neugram, but fails with gomacro, as `f` has been closed in cell-1.

could this be fixed?

thanks.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。