red / red

Red is a next-generation programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting and cross-platform reactive GUI, while providing modern support for concurrency, all in a zero-install, zero-config, single ~1MB file!
http://red-lang.org
Boost Software License 1.0
5.5k stars 417 forks source link

Selection on series with `path!` is undefined/untested #5532

Open hiiamboris opened 1 month ago

hiiamboris commented 1 month ago

Describe the bug

Total mess here, see the comments:

>> b: [a b a/b c]
>> b/('a/b)                        ;) seems to work
== c
>> select b 'a/b                   ;) or not??
== a/b
>> select/only b 'a/b              ;) or it does???
== c
>> b/('a/b): 'D
>> b
== [a D a/b c]                     ;) what is this result?
>> b/('a/b)                        ;) change at completely wrong place 🤦🏻‍♂️
== c
>> put b 'a/b 'E                   ;) and put is not even on par.. and why no put/only if there's select/only?
*** Script Error: put does not allow path! for its key argument
*** Where: put
*** Near : put b 'a/b 'E
*** Stack:  

To reproduce

b: [a b a/b c]
b/('a/b)
select b 'a/b 
select/only b 'a/b 
b/('a/b): 'D
b
b/('a/b)
put b 'a/b 'E

Expected behavior

put and path writes should accept any-type! key. Lookup semantic should mirror that of select.

Platform version

Red 0.6.5 for Windows built 2-Jul-2024/1:21:21+08:00  commit #bbecb7e
hiiamboris commented 1 month ago

Related but different in meaning put usage was proposed in https://github.com/red/red/issues/1233

greggirwin commented 1 month ago

This is where paths run into a wall, because of /only being either implied or not used. Of course it should be just one or the other. :^)

dockimbel commented 1 month ago

On first look I agree with Lookup semantic should mirror that of select.