Skip to content

modify KeySequence(string) , add repr()#139

Merged
hchunhui merged 4 commits intohchunhui:masterfrom
shewer:dev084
Sep 20, 2021
Merged

modify KeySequence(string) , add repr()#139
hchunhui merged 4 commits intohchunhui:masterfrom
shewer:dev084

Conversation

@shewer
Copy link
Copy Markdown
Contributor

@shewer shewer commented Sep 17, 2021

替換 另一個 支援 string 參數 直接初始化

Signed-off-by: Shewer Lu <shewer@gmail.com>
@hchunhui
Copy link
Copy Markdown
Owner

repr() 没问题。
make()parse() 的修改破坏了兼容性,好处(确实简明了)有限。最好是保留 parse()make() 用 lua api 做成两可,或者是 string 参数的 constructor 换一个名字。

@shewer
Copy link
Copy Markdown
Contributor Author

shewer commented Sep 17, 2021

在 lua_processor func( ) KeySequence 生成 obj 除非 掛在 _G or env 都會 被GC
生一個 keySquence 效率 和重用 instance
如果要重用 parse 的確是要保留
那還得 加上 clear()

@hchunhui
Copy link
Copy Markdown
Owner

不用再加 clear(),相信也不会有人想重用。只是为最大兼容计,允许如下代码也可工作(可能已经有脚本这样用了):

ks = KeySequence()
ks:parse("foobar")
--- use ks

Signed-off-by: Shewer Lu <shewer@gmail.com>
Signed-off-by: Shewer Lu <shewer@gmail.com>
Signed-off-by: Shewer Lu <shewer@gmail.com>
@hchunhui hchunhui merged commit c58099a into hchunhui:master Sep 20, 2021
shewer added a commit to shewer/librime-lua that referenced this pull request Oct 22, 2021
Signed-off-by: Shewer Lu <shewer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants