<-- back to the mailing list

[spec] comments on the proposed gemini spec revisions

Omar Polo op at omarpolo.com

Mon Oct 11 14:29:27 BST 2021

- - - - - - - - - - - - - - - - - - - 

Oliver Simmons <oliversimmo at gmail.com> writes:

On Mon, 11 Oct 2021 at 09:12, Omar Polo <op at omarpolo.com> wrote:
1. whitespace after gemtext elements
I don't have strong opinion on this, but on the other hand I don't see a
real motivation to require a space in your post nor in the gitlab
discussion. Whitespaces should not be mandatory if not strictly
required to separate fields (like in a link line) in my opinion at
least. But yes, I do always write '# hello there' and not '#hello
there'.
As someone who's making a basic gemini client, having the whitespace
makes it alot simpler, you can just split the line on the space and do
a `switch` on the first part.
Not having a space means you'd have to test if the line starts with
different things, which would be very annoying and slower in most
cases.
Having the whitespace is easier for clients,

I've seen this argument in the gitlab issue too, but sorry, I don'tbelieve it. In what language(s) splitting a string is faster thanchecking for a prefix? Splitting requires the allocation of multipleobjects, while the prefix only requires a scan of the first few bytes.

To be more precise: splitting on a space will always be slower thanchecking for a prefix even if we ignore the cost of allocating thestrings because you'd have to first scan the string for the first space(which can be far into the line) and then the cost of comparing strings(i.e. another scan) while checking for a prefix requires always to onlycompare the first few bytes.

Even if we eventually decide to mandate a whitespace, checking for aprefix would still lead to better and faster code.

and also looks better.

I totally agree! It *absolutely* looks better, but I think we shouldn'taccount for aesthetic too much in the spec, as they tend to change fromtime to time and from one person to another.

I see no downside to enforcing it in the spec (a SHOULD or MUST).

My argument is kind the opposite: if there isn't a (strong) reason forrequiring something, then that something MUST be optional. Whitespacesare required in the link line to separate unambiguously the link fromthe label, the other whitespaces in the "special" lines don't serve thispurpose so they need to be completely optional.