Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将 arity 为 1、2 的通常函数视为运算符? #30

Open
umajho opened this issue Oct 10, 2023 · 0 comments
Open

将 arity 为 1、2 的通常函数视为运算符? #30

umajho opened this issue Oct 10, 2023 · 0 comments

Comments

@umajho
Copy link
Owner

umajho commented Oct 10, 2023

这样的话:

  • 像是 d/1d/2or/2 等等这些运算符都变为通常函数:
    • 比如 d/2:既可以 3d4,也可以 d(3, 4),还可以 (&d/2).(3, 4)
  • 像是 count/1count/2has?/2at/2 也成了运算符:
    • 比如 count/*count $list$list count \($x -> $x > 50)
    • 比如 has?/2$list has? 42
    • 比如 at/2$list at 2

需要考虑:

  • KeywordList 怎么处理?
  • 右侧的参数是数字时,连在一起要怎么处理?
  • 要怎么区分 “单目运算右侧参数被括号包起来” 和 “一般的调用”?
  • 连在一起的时候可读性会比较差,那么:
    • 是否应该要求连在一起的时候应该用括号包起来(如 foo ($baz bar $qux) vs foo $baz bar $qux)?
    • 那是否应该特殊对待 d/*(如 foo 3d10 vs foo (3d10))?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant