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

VALUE? inconsistency #1914

Closed
rebolbot opened this issue Dec 6, 2012 · 4 comments
Closed

VALUE? inconsistency #1914

rebolbot opened this issue Dec 6, 2012 · 4 comments

Comments

@rebolbot
Copy link
Collaborator

rebolbot commented Dec 6, 2012

Submitted by: Ladislav

The VALUE? function served in R2 as a kind of guard against triggering an error when trying to get a value of a word.

This property made the function useful and it was also in agreement with the documentation stating that "Returns TRUE if the word has been set...Returns FALSE for all other values." (in R2) or "The VALUE? function returns TRUE if the specified word has a value. It returns FALSE if not." (in R3).

In both cases it is a consequence of logic that when the VALUE? function doesn't return TRUE it shall return FALSE.

; a word that "isn't bound to a context"
first to block! "x" ; == x
bound? first to block! "x" ; == none
; another word that "isn't bound to a context at present"
f: func [x] ['x]
f none ; == x
; now observe how the former is handled by VALUE?
value? first to block! "x" ; == false
; however, the latter is not handled in a compatible manner
value? f none
; ** Script error: x word is not bound to a context
; ** Where: value?
; ** Near: value? f none
; note that I do not disagree with the formulation;
; I disagree with the inconsistency

CC - Data [ Version: alpha 112 Type: Bug Platform: All Category: Native Reproduce: Always Fixed-in:none ]

@rebolbot
Copy link
Collaborator Author

rebolbot commented Dec 6, 2012

Submitted by: BrianH

This is a side effect of #1893. In the case of value? f none, the script error returned is incorrect. The word is not really not bound to a context, it's just bound to an out-of-scope function context. So, VALUE? isn't being inconsistent, the contexts are.

@rebolbot
Copy link
Collaborator Author

rebolbot commented Dec 8, 2012

Submitted by: Ladislav

Yes, the "out-of-scope function context" text looks more accurate. However, my opinion is that the VALUE? function documentation specifies that the function shall return FALSE when it does not return TRUE. Also, I do not think it is a side-effect of #1893.

@rebolbot
Copy link
Collaborator Author

Submitted by: Ladislav

In the core-tests suite.

@rebolbot
Copy link
Collaborator Author

rebolbot commented Aug 2, 2013

Submitted by: Ladislav

Pull request submitted.

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

No branches or pull requests

1 participant