Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Identity function #1987

Open
rebolbot opened this issue Mar 7, 2013 · 2 comments
Open

Identity function #1987

rebolbot opened this issue Mar 7, 2013 · 2 comments

Comments

@rebolbot
Copy link
Collaborator

rebolbot commented Mar 7, 2013

Submitted by: Ladislav

#626 already describes one identity function using unevaluated argument. However, my experience is telling that it is useful to have a similar function with evaluated argument.

identity: func [
    "Returns the value passed to it."
    value [any-type!]
] [
    :value
]

CC - Data [ Version: r3 master Type: Wish Platform: All Category: Mezzanine Reproduce: Always Fixed-in:none ]

@rebolbot
Copy link
Collaborator Author

rebolbot commented Mar 7, 2013

Submitted by: BrianH

It seems like it would be pretty rarely used, mostly as a function value in general transformation operations. Maybe giving it the full name IDENTITY would be more appropriate, both because it would be easier to remember what it does when seeing it in code, and as a Huffman-coding approach to names. If you don't see functions often it can be harder to read the code without having to backtrace or use HELP, so not abbreviating the name can make things easier. ID seems more like the name of a user function or variable.

@rebolbot
Copy link
Collaborator Author

rebolbot commented Mar 7, 2013

Submitted by: Ladislav

"Maybe giving it the full name IDENTITY would be more appropriate"

I am OK with that

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant