REBOL3 tracker
  0.9.12 beta
Ticket #0002198 User: anonymous

Project:

Previous Next
rss
TypeWish Statusreviewed Date3-Mar-2015 02:29
Versionr3 master CategoryNative Submitted byfork
PlatformAll Severitymajor Prioritynormal

Summary COMPOSE without /ONLY should omit NONE! values (unless wrapped in a block)
Description Currently:

>> compose [something (if 1 > 2 [stuff]) something-else]
== [something #[none!] something-else]

This results in you having to write the likes of:

>> compose [something (either 1 > 2 [stuff] [[]]) something-else]
== [something something-else]

If empty blocks are willing to vaporize if you don't use /ONLY, then so should a NONE! value. If you wanted the NONE! value, you could have used COMPOSE/ONLY or COMPOSE with the NONE! inside of a block:

>> compose [something (either 1 > 2 [stuff] [[#]]) something-else]
== [something #[none!] something-else]

(Note: Pending finalization of notation of literal none! ... today it is #, but should probably be something else. Working proposal: ##)
Example code
Current:

>> compose [something (if 1 > 2 [stuff]) something-else]
== [something #[none!] something-else]

>> compose [something (none) something-else]
== [something #[none!] something-else]

>> compose [something ([#[none!]]) something-else]
== [something #[none!] something-else]

>> compose/only [something (if 1 > 2 [stuff]) something-else]
== [something #[none!] something-else]

Desired:

>> compose [something (if 1 > 2 [stuff]) something-else]
== [something something-else]

>> compose [something (none) something-else]
== [something something-else]

>> compose [something ([#[none!]]) something-else]
== [something #[none!] something-else]

>> compose/only [something (if 1 > 2 [stuff]) something-else]
== [something #[none!] something-else]

Assigned ton/a Fixed in- Last Update5-Mar-2015 13:52


Comments
(0004579)
BrianH
3-Mar-2015 03:33

We still need COMPOSE without /only to be able to include #[none] values because /only also makes it insert blocks as values instead of inline; if we didn't need that, we could just use REDUCE. We need to insert #[none] pretty often to act as placeholder non-values or constructed arguments.

So I agree with the need for easier omission expressions, but not with this option. Good idea, needs a rethink, we'll adjust the ticket accordingly.
(0004580)
fork
3-Mar-2015 03:42

I think that "we" in your case usually means "you" as a Mezzanine coder or Rebol internals! :-)

Inserting a literal none without /ONLY would still be possible, but it would put the burden on that case to be more like what people have to do today for the non-none case. So just return a block with a NONE! in it. That covers it, right?

>> compose [something (either 1 > 2 [stuff] [[#]]) something-else]
== [something #[none!] something-else]

(Note: we have been speaking of the new literal for NONE as being ## for the reasons given in chat of why a lone # would be too "sticky" for some literal notations and wouldn't fit in a broader model of space significance. Either way you could write `reduce [none]`...I was just saying it should be even easier)

This would be best of both worlds, and make the real common case for users work right.
(0004581)
BrianH
3-Mar-2015 03:57

Actually, "we" as in anyone who has used Rebol blocks as fixed-length records for data processing, one of the traditional uses of Rebol and the reason for all of those /skip options everywhere. There is a lot of code that uses blocks instead of a database, and databases often need nulls. The series model of Rebol 3 was changed to make #[none] be treated as a general placeholder for the cases where you don't really have a value there, but you still have a there. If anything, we use #[none] more in Rebol 3 than we ever did in prior versions of Rebol.

It's actually less necessary for code generation, only needing to be done when composing expressions that have limited evaluation for safety purposes. The positional APPLY makes that kind of thing less necessary to do with COMPOSE now.
(0004582)
fork
3-Mar-2015 04:22

I don't have a problem with it, I just don't see why it is a problem to say "insert a block with a NONE! value in it". The block will be dissolved, the NONE! will remain.

(For the record, I have *NEVER* needed a #[none!] in a COMPOSE.)

The value of not making the average person need to say "either" with [[]] to get a conditional insertion of nothing seems extremely high. The burden of asking those who want literal NONE! to say either with `[[##]]` (or similar) seems low for those cases when it comes up. It's more clear and explicit, for (what I believe to be) the less common case.
(0004588)
BrianH
5-Mar-2015 13:52

Wanting to skip inserting anything is a more common need than wanting to insert #[none!], and inserting [#[none!]] is easy enough. Seems worth it. Keep the same behavior for #[unset!] though.

Date User Field Action Change
5-Mar-2015 13:57 BrianH Comment : 0004588 Modified -
5-Mar-2015 13:52 BrianH Comment : 0004588 Added -
5-Mar-2015 13:50 BrianH Status Modified problem => reviewed
5-Mar-2015 13:50 BrianH Code Modified -
3-Mar-2015 05:21 Fork Comment : 0004582 Modified -
3-Mar-2015 04:32 Fork Description Modified -
3-Mar-2015 04:30 Fork Summary Modified COMPOSE without /ONLY should omit NONE! values => COMPOSE without /ONLY should omit NONE! values (unless wrapped in a block)
3-Mar-2015 04:22 Fork Comment : 0004582 Modified -
3-Mar-2015 04:22 Fork Comment : 0004582 Added -
3-Mar-2015 03:57 BrianH Comment : 0004581 Added -
3-Mar-2015 03:45 Fork Comment : 0004580 Modified -
3-Mar-2015 03:45 Fork Comment : 0004580 Modified -
3-Mar-2015 03:44 Fork Comment : 0004580 Modified -
3-Mar-2015 03:43 Fork Comment : 0004580 Modified -
3-Mar-2015 03:42 Fork Comment : 0004580 Added -
3-Mar-2015 03:37 BrianH Comment : 0004579 Modified -
3-Mar-2015 03:33 BrianH Status Modified submitted => problem
3-Mar-2015 03:33 BrianH Category Modified Unspecified => Native
3-Mar-2015 03:33 BrianH Comment : 0004579 Added -
3-Mar-2015 02:29 Fork Severity Modified minor => major
3-Mar-2015 02:29 Fork Code Modified -
3-Mar-2015 02:29 Fork Description Modified -
3-Mar-2015 02:29 Fork Ticket Added -