REBOL3 tracker
  0.9.12 beta
Ticket #0002091 User: anonymous

Project:



rss
TypeWish Statusproblem Date6-Nov-2013 19:19
Versionr3 master CategorySyntax Submitted bymaxim
PlatformAll Severityminor Prioritylow

Summary general consensus on the Rebol [ ] header being optional in R3?
Description I added this ticket to gather if there is any real consensus in the fact that R3 does not require a header anymore.

one might argue that the header is annoying.

But forcing it has historically meant everyone actually puts something in it.

This is a far cry from most of the code I see in all other languages.

Many projects in other languages don't have a single clean file header in a single file of the code base.

People releasing scripts with only REBOL [] at the beginning, gives a poor reflection on the author, so even the most basic author, file and version are usually somewhat up to date.

furthermore, many tools expect the header in order to display things like the title copyrights of version.

I fear people will just end up putting that info in a global string instead... we end up with no net benefit, but loss of a useful gathering of information up top.

Making it optional, makes it just that, optional and less important... I fear newbies and less organized authors will not pick up (or loose) the habit and we will be left with many anonymous and uncredited scripts lying around.

note that by using read, we could already load scripts with no headers, but it was the exception for when the script is just a snippet or in transit from some port or dataset.

what's your take.

Example code
; given a file with no Rebol header,

; R2 requires a 'READ or it returns an error 
; (making it a choice of the calling script 
;  to allow no headers)
do read %code.r

;----
; R3 has no issue and runs it directly.
; making it a choice of the author to include a header.
do %code.r

Assigned ton/a Fixed in- Last Update1-Feb-2014 00:30


Comments
(0004116)
maxim
6-Nov-2013 19:51

For myself, I wish headers where required. Just like it was in R2...
(0004117)
maxim
6-Nov-2013 22:20

Required headers... Tally so far:

For: Doc Kimble, Kealist, Maxim, Johnk, rgchris

Against: Ladislav, Carl
(0004118)
rgchris
7-Nov-2013 00:31

Had no idea headers had become optional--am also in favour of the requirement (increasingly I also use headers when saving data--SAVE/HEADER--just seems like good practice all round).
(0004119)
Ladislav
7-Nov-2013 08:48

I am OK with the way things are in R3. I also think that Carl gave it some thought before making the change. In general, Rebol "philosophy" seems to be to let the user decide what she prefers instead of forcing her to use a particular pattern. For example, the core-test suite does have a header in a sense, but not the "standard" one, since that is both sufficient and practical.
(0004121)
maxim
7-Nov-2013 17:36

I'd also add that scripts can have multiple headers if the code is supported in multiple languages. The various loaders are supposed to skip anything before the header if they find one.
(0004122)
Ladislav
7-Nov-2013 17:44

You can add Carl to the side not requiring header. It was his idea as far as I know.
(0004123)
maxim
7-Nov-2013 17:46

good point
(0004142)
abolka
10-Nov-2013 17:58

I prefer the leniency currently provided by R3: scripts ("DO") don't require a header, modules ("IMPORT") do.
(0004143)
fork
10-Nov-2013 23:54

I like requiring it better, myself, and side with the argument that it's better for the ecosystem.

But the question I'd have is how to guide people who are saving data files. It isn't really "Rebol" or "Red" at that point.

What can appear in that slot before the block? So far we have path! ("Red/System"), and word!

http://stackoverflow.com/questions/19257281/

Should LOAD be able to come back with telling you what kind of data it was based on reading that?
(0004144)
Ladislav
11-Nov-2013 00:21

"I'd also add that scripts can have multiple headers if the code is supported in multiple languages. The various loaders are supposed to skip anything before the header if they find one. " - I think that I would need a manual explaining this idea to me. Otherwise, my guess is that Rebol would not understand

Rebol []
Red []
; something here

, while Red would not understand

Red []
Rebol []
; something else here
(0004151)
Ladislav
17-Nov-2013 12:08

Since this proposal actually goes against the design principles on which Carl built R3, it is rather problematic.
(0004154)
Gregg
17-Nov-2013 19:27

I like flexibility, but I also like consistency. One of the things I use headers for, even if it's empty, is to give me a clue that the contents are meant to be executed (DO), not just loaded.

I don't have a strong preference either way, but we should have a consensus statement about their use.
(0004199)
rgchris
19-Nov-2013 22:43

Incidentally, this thread killed my comments aggregator as the API (Rebol) representation of this ticket does not have a header:

http://curecode.org/rebol3/api.rsp?type=ticket&show=all&id=2091

And that the data contains a header sequence (from Ladislav's comment #4144) that breaks LOAD (switched to LOAD/ALL). I believe the header is good practice for code AND data and is consistent with the spirit of Rebol as a messaging language (from http://www.rebol.com/rebolsteps.html#section-9).

As to whether a variant of Rebol supports one form of header ID or not would depend on how liberal the loader is. As currently the Rebol loader invokes the SCRIPT? function, it's not too much to suppose that it could detect the format and select the appropriate parsing rules based on the stated language so long as it's supported. I use a custom SCRIPT? function for my Colorizer in this way that amongst other things allows Rebol 2 to parse Rebol data with an incompatible Needs header, or with a Red(/System) header, or even Topaz. Granted, this might not be most efficient, but would be nice to have at least a plugin-able option.

https://github.com/revault/desktop.rebol.info/blob/master/app/support/markup/header.r

Additionally, it might not be the worst thing to have versioning in the ID itself to discern between different versions of the format. e.g. Rebol 3.0 [] -- I don't mean to encourage a diffuse set of formats, but revisions will happen and it might be wise to have a contingency plan.
(0004219)
BrianH
1-Feb-2014 00:30

Add my vote against requiring a header unless it's necessary. If a header is meaningful then it's required, otherwise it shouldn't be required.

It should be possible to have multiple Red and Rebol scripts in the same file if they use their respective script embedding features (which require headers). Red has embedded/multi-script support like Rebol, doesn't it?

Rebol's LOAD model and infrastructure were designed to allow the script portion of the script to be parsed by different parsers depending on settings in the header, and to a certain extent this is done already. As long as the header data syntax is the same, and the appropriate parser is supported, sys/load-header should provide enough information to allow you to figure out which parser you should use. And if you use a different header keyword then there's no reason to expect the header data to have the same syntax.

Advanced scripts almost always end up needing some feature that requires a header, so they tend to have headers. However, not requiring a header allows LOAD to process data files that might not have originated with Rebol, but are still compatible with it. I don't see the point in requiting a header when there is no meaning expressed by the header, such as when it's empty and has nothing before it or otherwise isn't used for script embedding.

Date User Field Action Change
17-Feb-2014 21:03 BrianH Comment : 0004219 Modified -
1-Feb-2014 01:01 BrianH Comment : 0004219 Modified -
1-Feb-2014 00:30 BrianH Comment : 0004219 Added -
19-Nov-2013 22:43 rgchris Comment : 0004199 Added -
17-Nov-2013 19:27 Gregg Comment : 0004154 Added -
17-Nov-2013 12:08 Ladislav Status Modified reviewed => problem
17-Nov-2013 12:08 Ladislav Comment : 0004151 Added -
12-Nov-2013 08:52 Ladislav Status Modified submitted => reviewed
12-Nov-2013 08:52 Ladislav Code Modified -
12-Nov-2013 08:52 Ladislav Description Modified -
11-Nov-2013 00:21 Ladislav Comment : 0004144 Added -
10-Nov-2013 23:54 fork Comment : 0004143 Added -
10-Nov-2013 17:58 abolka Comment : 0004142 Added -
7-Nov-2013 17:46 maxim Comment : 0004117 Modified -
7-Nov-2013 17:46 maxim Comment : 0004123 Added -
7-Nov-2013 17:44 Ladislav Comment : 0004122 Added -
7-Nov-2013 17:36 maxim Comment : 0004121 Added -
7-Nov-2013 17:30 maxim Comment : 0004117 Modified -
7-Nov-2013 17:29 maxim Comment : 0004117 Modified -
7-Nov-2013 08:53 Ladislav Comment : 0004119 Modified -
7-Nov-2013 08:49 Ladislav Comment : 0004119 Modified -
7-Nov-2013 08:48 Ladislav Comment : 0004119 Added -
7-Nov-2013 00:31 rgchris Comment : 0004118 Added -
6-Nov-2013 22:20 maxim Comment : 0004117 Added -
6-Nov-2013 19:51 maxim Comment : 0004116 Added -
6-Nov-2013 19:19 maxim Ticket Added -