You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this is expected. Maybe the example can be adjusted to be less confusing, but generally examples are run in a REPL-like setting, and things can work differently between modules and the REPL (top level).
The long explanation: The difference in fun name .... and def name: fun .... is a known issue. Normally, fun comes with static infos including call results and function arity. The definition fun (former) associates those with the defined name, while the expression fun (latter, inside the def) wraps those onto the function expression. Unfortunately, because fun is both a definition and expression, the conservative shortcut that propagates static infos from the right-hand side of def can’t apply, and only the former gets a binding in the statinfo space. And, as expected, redefinition (here, in the statinfo space) is not allowed within a module. However, examples are run in a REPL-like setting, and so redefinition works.
If anyone has an idea how to solve the mentioned issue, please help!
When I was reading the guide, I tried one of the examples described in it, but an error occurred.
description
When
fun zero()
andstatinfo.macro 'zero'
are declared at the same time, an "Identifier already defined: zero" error will appear.link
online docs: https://docs.racket-lang.org/rhombus/annotation-macro.html
source:
rhombus/rhombus/rhombus/scribblings/guide/annotation-macro.scrbl
Lines 166 to 179 in 4889089
reproducible code
It looks like there are some subtle differences between "def fun" and "fun", is this a bug or is it by design?
The text was updated successfully, but these errors were encountered: