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

to-string and form omit the "decoration" for any-word! values , but not for any-path! values #3409

Closed
meijeru opened this issue Jun 8, 2018 · 4 comments
Assignees
Labels
status.built A change in codebase has been done to address the ticket. status.tested The change in code has been manually tested and verified to fix the issue. test.written A regression test has been written and tested for the ticket. type.design Things that require (re)design effort, not just implementation.
Milestone

Comments

@meijeru
Copy link
Contributor

meijeru commented Jun 8, 2018

Expected behavior

to-string and form should treat any-word! and any-path! values similarly

Actual behavior

form quote :a => a ;; the : is left out
form quote :a/b/c => :a/b/c ;; the : is kept

to-string does exactly the same; both do this for get-, lit- and set- words and paths.

I plead for consistency, as usual

Steps to reproduce the problem

Execute in any interpreter

Red and platform version

all
@meijeru
Copy link
Contributor Author

meijeru commented Jun 8, 2018

A full overview of the behaviour of to-string form mold and mold/all is found here View as HTML.

@greggirwin
Copy link
Contributor

This is interesting. It occurred to me that we should look at how values are round-tripped in conversions. e.g.

>> to file! "a"
== %a
>> to string! to file! "a"
== "a"
>> to file! mold to file! "a"
== %%25a
>> to file! form to file! "a"
== %a

Which came from looking at the code and seeing that the current behavior is by design. *-word! types inherit form/mold from the base word! type, but *-path! types do not inherit them from path!. They explicitly have their own implementation.

This makes them compatible with R2, but not R3. In R3 you have this behavior:

>> form quote :a
== ":a"

>> form quote :a/b/c
== ":a/b/c"

>> to get-word! form quote :a
** Syntax error: invalid character in: ":a"
** Where: to
** Near: to get-word! form quote :a

>> to get-path! form quote :a/b/c
== ::a/b/c

Seems we need to think about big picture goals and uses, decide, and document those choices.

@dockimbel dockimbel self-assigned this Jun 21, 2019
@hiiamboris
Copy link
Collaborator

@meijeru how about the 1st line in your list: mold/all () returns "unset" which is loaded as a function
Is there an issue about that?

@meijeru
Copy link
Contributor Author

meijeru commented Nov 23, 2019

@hiiamboris Not that I know of.

@dockimbel dockimbel added the type.design Things that require (re)design effort, not just implementation. label Sep 19, 2022
dockimbel added a commit that referenced this issue Nov 17, 2023
…rd! values , but not for any-path! values)
@dockimbel dockimbel added status.built A change in codebase has been done to address the ticket. status.tested The change in code has been manually tested and verified to fix the issue. test.written A regression test has been written and tested for the ticket. labels Nov 17, 2023
@dockimbel dockimbel added this to the 0.7.0 milestone Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status.built A change in codebase has been done to address the ticket. status.tested The change in code has been manually tested and verified to fix the issue. test.written A regression test has been written and tested for the ticket. type.design Things that require (re)design effort, not just implementation.
Projects
None yet
Development

No branches or pull requests

4 participants