red icon indicating copy to clipboard operation
red copied to clipboard

[Regression] get path evaluates it's argument

Open hiiamboris opened this issue 4 years ago • 6 comments

Describe the bug

>> about
Red 0.6.4 for Windows built 13-Jun-2021/10:10:47+03:00  commit #79ded2f
>> c: context [f: does [print 123]] get 'c/f
== func [][print 123]

>> about
Red 0.6.4 for Windows built 4-Jul-2021/2:04:09+03:00  commit #1e4fb1b
>> c: context [f: does [print 123]] get 'c/f
123

Expected behavior

No evaluation.

hiiamboris avatar Oct 29 '21 21:10 hiiamboris

get/any works as expected.

>> c: context [f: does [print 123]] get/any 'c/f
== func [][print 123]

In the interpreter, the get value will be evaluated if no /any refinement. https://github.com/red/red/blob/master/runtime/interpreter.reds#L733

qtxie avatar Oct 30 '21 07:10 qtxie

get/any shouldn't even exist IMO ;)

hiiamboris avatar Oct 30 '21 07:10 hiiamboris

Good note @qtxie but /any is there only for unset! handling, isn't it?

greggirwin avatar Oct 30 '21 18:10 greggirwin

@greggirwin According to the documents, yes. I pointed it out as I don't see a code branch to handle this case. The get? parameter in interpreter/eval-path should be used for it, but it's set by the /any refinement now. @dockimbel Do we need to add another any? parameter for the function?

qtxie avatar Oct 31 '21 02:10 qtxie

Result of ? system/console/do-command is fun

hiiamboris avatar Mar 08 '22 15:03 hiiamboris

>> o: object [x: 1 unset 'x]
== make object! [
    x: unset
]
>> ? o/x
*** Script Error: value needs a value
*** Where: set
*** Near : ? o/x
*** Stack: ? help-string  

hiiamboris avatar Jun 28 '22 12:06 hiiamboris