Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Grammars
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Carl Mäsak  
View profile  
 More options Sep 13 2008, 11:05 am
From: "Carl Mäsak" <cma...@gmail.com>
Date: Sat, 13 Sep 2008 17:05:11 +0200
Local: Sat, Sep 13 2008 11:05 am
Subject: Re: [november] Grammars
Carl (>):

> Oops! I'm already working full speed on this in a separate (local)
> branch. Sorry for duplicating work by not telling. :/

Here's me telling a bit more, to compensate. :)

I had an interesting experience separating out the markup parsing code
yesterday. Interesting to me, anyway, at my current (early) stage of
the learning curve towards becoming a real programmer.

It occurred when I wanted to move out format_html from Wiki.pm into
Wiki/Markup/Minimal.pm -- suddenly the method make_link($title), which
produces strings of the form '<a href="...">$title</a>' as part of the
eventual output, was not visible anymore, as it was still in Wiki.pm.

Big deal, so move that as well, right? Ah, but make_link actually does
different things depending on whether the page exists or not. To do
this, it calls methods on $.storage, an attribute of the Wiki class.
So make_link should remain in the Wiki class for this reason -- and
for other reasons, such as it being used in other parts of the wiki
except for the formatter.

Ok, so I wanted to move the make_link method, except I couldn't. To
me, this seemed like a good time to perform what some people call
"Dependency Injection", and which Wikipedia defines as "supplying an
external dependency to a software component". That was exactly what I
wanted to do. Preferably just send the method make_link along as a
parameter to the formatter somehow.

However... I never figured out how to do this. I don't know yet if I'm
missing something, if Rakudo isn't capable of it yet, or if I'm simply
trying to do the impossible. Some of my bug reports today have been
about this.

The basic problem is the following: what I want isn't just to send in
the method make_link as a parameter, but to send it in so that it is
then called as a sub, not as a method. I think I want something like
.assuming(self=>self). If anyone has any idea how to emulate this
today in Rakudo, let me know.

What I'm doing right now instead is keeping a $.wiki attribute in the
formatter, and having the formatter call make_link that way. Less than
ideal.

// Carl


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.