💾 Archived View for rawtext.club › ~sloum › geminilist › 007295.gmi captured on 2024-03-21 at 15:56:02. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
Oliver Simmons oliversimmo at gmail.com
Wed Oct 13 19:54:53 BST 2021
- - - - - - - - - - - - - - - - - - -
On Mon, 11 Oct 2021 at 15:12, Omar Polo <op at omarpolo.com> wrote:
I've seen this argument in the gitlab issue too […]
I haven't checked the issue yet, will do after sending this.
In what language(s) splitting a string is faster than
checking for a prefix? Splitting requires the allocation of multiple
objects, while the prefix only requires a scan of the first few bytes.
I said simpler, not faster. What you said is true in some cases, butnot everyone is striving for optimisation speed-wise.
It'll depend on the language used, but splitting allows you to use asimple equality switch statement, which isn't possible by checkingwith a prefix.The way I understand your message, I would have to use an else-iflist, which is hardly ideal.
e.g. in C#:```// If it's <3 chars then just treat it as a text line (the default).switch ((line.Length < 3) ? "" : line.Substring(0, 3).Split(" ", 2)[0]){ case "=>": … case "* ": … … and so on … default: …}```vs```if (line.StartsWith("=
") { …} else if (line.StartsWith("* ") { …} … and so on …else { … }```
At the least, it should be required for link (as you said) and listlines ("* "). I've seen where people have tried to use *emphasis* atthe start of a line and got a bullet point by mistake.
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 for
requiring something, then that something MUST be optional. Whitespaces
are required in the link line to separate unambiguously the link from
the label, the other whitespaces in the "special" lines don't serve this
purpose so they need to be completely optional.
At the very least it should be recommended by the spec IMO.
-Oliver Simmons (GoodClover)