Closed c42f closed 1 year ago
Hi, thanks for the issue.
(:*=(f))
customizes the operation y *= f(args...)
, which does not obey Julia's semantics. In Julia, y *= f(args...)
is equivalent to y = y * f(args...)
, however, assign in reversible programming is not allowed.
Thanks so much for the explanation :-)
The underlying parsing problem is that it's quite hard to disambiguate between anonymous functions argument lists vs parenthesized function names. The reference parser does this disambiguation one particular way but it has some inconsistencies which I've fixed in JuliaSyntax. However, this meant the particular syntax that NiLang
uses parses differently.
The disambiguation I use currently gets confused because (:*=(f))
contains an Expr(:call)
which leads the parser to think it's parsing the body next.
I'll see whether I can think of an extension to the current disambiguation rules which lets the NiLang syntax parse and also parses everything else correctly.
I see your point. I will consider changing the design to remove ambiguity. But it will take some time.
I think I've got a fix for this in JuliaSyntax
. So despite this being "a bit weird" this syntax will continue to work! Understanding your use case was very helpful thanks :)
Hey, as part of writing JuliaSyntax and trying to integrate it over at https://github.com/JuliaLang/julia/pull/46372 I've noticed you have some weird syntax in this package for a few function definitions with
@i
. For example:https://github.com/GiggleLiu/NiLang.jl/blob/a80e991bf88021181b7e9b5199868152d8bd3a15/src/ulog.jl#L5-L7
The part with the function being named
(:*=(identity))
- that seems really weird and maybe not entirely intentional that the reference parser supports this. I don't know what this syntax is meant to mean or whether I should try to accommodate it. NiLang and NiLangCore are the only package using such syntax as far as I can tell.Here's the report from my test tool: