Optimizing for the common case
We all use constructs every day that derive from the design objective that is the title of this post. The most commonly encountered is one that (allegedly) Ritchie of K&R discovered: that assignment occurs far more often than equivelency tests, and thus we use '=' for assignment and '==' for equivelency tests in C derived languages. In perl we see this in the departure from the norm in regexes, with metacharacters being escaped to become normal versus the more common normal characters escaped to become metacharacters (we write /(a*)/ not /\(a\*\)/ or whatever)

Which brings me to perlmonks. (See I am posting in the right place :-) In my experience when using the [pad://demerphq] link mechanism I am almost always giving a link to my own pad, rarely I end up doing it with someone else scratch pad, and even then its normally to show them how to do the link. Of course I assume that this is true for others as well.

So why is the link mechanism both in how its used and how it renders optimized for the least common case? Consider how it is rendered. [pad://demerphq] gets rendered (for me of course, your domain might differ) as <A HREF="/index.pl?node_id=108949&user=demerphq">demerphq's scratch pad</A> Which to me doesnt make sense. Normally i want to say something like "have a look at my [pad://demerphq]" but that renders as "have a look at my [demerphqs scratch pad]" which if I want it to render naturally I have to say "have a look at my [pad://demerphq|pad]".

Rendering aside (I brought it up first because IMO its probably easier to change) we get to the default behaviour of the [pad://] link. Why (assuming i have typed it in) does it not default to my own name? After all PM knows its me (I wouldnt be chattering otherwise).

So my proposal is this:

  1. Make [pad://] default to the user who entered it
  2. Make [pad://] render as "my scratch pad"
  3. Make [pad://Name]render as currently
  4. Make [pad://Name|String]render as currently

Thus the current usage wouldnt change (no suprises) but we would have it optimized for the most common usage, both on a link level and on a rendering level.

And yes I realize that in the grand scheme of PMDEV issues this a low priority. What I'm after is whether this also annoys other people and whether they think my cure is appropriate. Implementation (and related issues) can be left until a consensus is found.

Cheers all,

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Edit kudra, 2002-04-24 Modified title, heading per author's request


In reply to Make linking to your own scratch pad easier by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.