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

CONSTRUCT doesn't special-case none, logic! keywords, lit-words or lit-paths like R2. #651

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 0 comments
Labels

Comments

@Siskin-Bot
Copy link
Collaborator

Siskin-Bot commented Feb 15, 2020

Submitted by: BrianH

CONSTRUCT in R3 doesn't special-case none, true, false, on and off keywords like R2 does, so the assigned values end up being the words none, true, false, on and off instead. Also, lit-words end up being assigned as lit-word! values, rather than word! values, and lit-paths end up being assigned as lit-path! values, rather than path! values.

Among other things, this currently affects REBOL headers because LOAD calls CONSTRUCT, same as in R2.

Proposed default behavior: Like R2's CONSTRUCT, except also have yes and no keywords translate to logic! values, and have unset! values translate to none. Both of these improvements are critical. The screening code in mezz-load 620-621 is a good model.

Also see #687 for an /only option.

; In R2:

>> type? get in construct [a: true] 'a
== logic!
>> type? get in construct [a: false] 'a
== logic!
>> type? get in construct [a: on] 'a
== logic!
>> type? get in construct [a: off] 'a
== logic!
>> type? get in construct [a: yes] 'a
== word!
>> type? get in construct [a: no] 'a
== word!
>> type? get in construct [a: none] 'a
== none!
>> type? get/any in construct head insert tail [a:]() 'a
== unset!
>> type? get in construct [a: b] 'a
== word!
>> type? get in construct [a: 'b] 'a
== word!
>> type? get in construct [a: b/c] 'a
== path!
>> type? get in construct [a: 'b/c] 'a
== path!

; In R3 2.100.36:

>> type? get in construct [a: true] 'a
== word!
>> type? get in construct [a: false] 'a
== word!
>> type? get in construct [a: on] 'a
== word!
>> type? get in construct [a: off] 'a
== word!
>> type? get in construct [a: yes] 'a
== word!
>> type? get in construct [a: no] 'a
== word!
>> type? get in construct [a: none] 'a
== word!
>> type? get/any in construct head insert tail [a:]() 'a
** Script error: invalid argument: unset!
** Where: construct
** Near: construct head insert tail [a: unset!] [] 'a
>> type? get in construct [a: b] 'a
== word!
>> type? get in construct [a: 'b] 'a
== lit-word!
>> type? get in construct [a: b/c] 'a
== path!
>> type? get in construct [a: 'b/c] 'a
== lit-path!

; Desired R3 behavior without /only

>> type? get in construct [a: true] 'a
== logic!
>> type? get in construct [a: false] 'a
== logic!
>> type? get in construct [a: on] 'a
== logic!
>> type? get in construct [a: off] 'a
== logic!
>> type? get in construct [a: yes] 'a
== logic!
>> type? get in construct [a: no] 'a
== logic!
>> type? get in construct [a: none] 'a
== none!
>> type? get/any in construct head insert tail [a:]() 'a
== none!
>> type? get in construct [a: b] 'a
== word!
>> type? get in construct [a: 'b] 'a
== word!
>> type? get in construct [a: b/c] 'a
== path!
>> type? get in construct [a: 'b/c] 'a
== path!

Imported from: CureCode [ Version: alpha 36 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 38 ]
Imported from: metaeducation#651

Comments:

Rebolbot commented on Feb 22, 2009:

Submitted by: BrianH

I am personally in favor of keeping this change, as it makes CONSTRUCT more useful for data structure creation.

LOAD workaround in mezz-load 617.

It might be a good idea to have the workaround behavior by default, and the no-workaround behavior with an /only option - that would be REBOL-like. Either that or add the workaround as a mezzanine.


Rebolbot commented on Feb 26, 2009:

Submitted by: Carl

It's a bug. CONSTRUCT exists mainly to load things like headers. If we want a lighter version that does not safe-reduce, we can add that as a refinement.


Rebolbot commented on Feb 26, 2009:

Submitted by: BrianH

Well, since it's a bug I have to change the description accordingly:
Description updated (again) and more comprehensive examples added.


Rebolbot commented on Feb 26, 2009:

Submitted by: BrianH

Testing of 2.100.37 confirms that the bug is partially fixed: the keywords true, false, on, off and none are translated.

Still to do: yes and no keywords, lit-word! translation to word!, lit-path! translation to path!, unset! translation to none!, and the /only option to undo all of this. Of these the only urgent one is the unset! translation to none! - the rest are only high or normal priority.


Rebolbot commented on Mar 25, 2009:

Submitted by: Carl

All above should be fixed now.

Please move /only to a new ticket, so we can close the urgent part of this one.


Rebolbot commented on Mar 25, 2009:

Submitted by: BrianH

The /only option has been moved to #687.


Rebolbot added Type.bug and Status.important on Jan 12, 2016


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

No branches or pull requests

2 participants