metaeducation / rebol-issues

6 stars 1 forks source link

Inconsistent MOLD/all serial formats: IMAGE! vs VECTOR! #1039

Open rebolbot opened 15 years ago

rebolbot commented 15 years ago

Submitted by: Carl

MOLD/all of image! contains no inner blocks, but of vector! there appears to be an extra. Which should be the standard?!

This problem manifests itself in this issue: pick the correct form for a serialized indexed vector:

1. #[vector! [integer! 32 2 [1 2] 2]]
2. #[vector! [integer! 32 2 [1 2]] 2]

Also, keep in mind that vectors in 3.1 can be multi-dimensional, which means they may have a number of value init blocks.

>> mold/all make image! 1x1
== "#[image! 1x1 #{^/000000^/}]"

>> mold/all make vector! 1
== "#[vector! [integer! 32 1 [^/0^/]]]"

CC - Data [ Version: alpha 65 Type: Bug Platform: All Category: n/a Reproduce: Always Fixed-in:alpha 66 ]

rebolbot commented 15 years ago

Submitted by: Carl

Unless some other argument can be made, it looks like it needs to be the same as IMAGE! serial format: no extra block.

>> mold make vector! 3
== "make vector! [integer! 32 3 [^/0 0 0^/]]"
>> mold next make vector! 3
== "make vector! [integer! 32 2 [^/0 0^/]]"
>> mold/all next make vector! 3
== "#[vector! integer! 32 3 [^/0 0 0^/] 2]"
rebolbot commented 15 years ago

Submitted by: BrianH

I'm OK with no extra block, as long as multiple indexes could be specified in theory. Multiple index integers could do it, and the multiple dimensions of a multi-dimensional vector could be formatted as nested blocks, similar to what is returned by ARRAY.

Like this:

>> #[vector! integer! 32 3 2 [[0 0 0] [0 0 0]] 2 2]
or this:
>> #[vector! integer! 32 [3 2] [[0 0 0] [0 0 0]] 2 2]
or this:
>> #[vector! integer! 32 [3 2] [[0 0 0] [0 0 0]] [2 2]]

Not sure which I prefer. The latter two would be easier to compose in the MAKE spec form with COMPOSE/only:

>> make vector! [integer! 32 [3 2] [[0 0 0] [0 0 0]]]
== make vector! [integer! 32 [3 2] [
[0 0 0] [0 0 0]
]]
>> make vector! [integer! 32 [3 2] [0 0 0 0 0 0]]
== make vector! [integer! 32 [3 2] [
[0 0 0] [0 0 0]
]]
>> make vector! compose/only [integer! 32 (dimensions) (data)]
rebolbot commented 15 years ago

Submitted by: Carl

I'm going to conclude this specific bug (image! vs vector!). The issue of dims needs discussion separately.

rebolbot commented 15 years ago

Submitted by: BrianH

Note: The vector! syntax was changed to the no-extra-block style.