Re: [check] strange usage of $File->{Version}

Olivier Thereaux <ot@w3.org> wrote:

>I'd appreciate if we could figure out what, in check, $File->{Version}
>actually is. In most cases, it's used as "the best name we have for
>the document type".

«The best info we currently have for what kind of document this is.»


>Except that it also seems to be used to hold the content of the "version"
>attribute of the root element, "sniffed" from the ESIS:

This is a legacy thing, but it’s trying to use the @version to guess in case we
won’t get better information from a DOCTYPE declaration. Basically it’s an
attempt to work around the fact that OpenSP doesn’t report the effective FPI in
its output.


>- is my analysis correct? Did I miss or misunderstand anything?

Essentially, yes.


>- is that a honest mistake, due to some confusion in variable names,
>or is it on purpose?

It’s deliberate. $File->{Version} is where we stash the best info we have about
the document type at any given point in the code. As we find more info the
contents of the variable gets closer to what will eventually be displayed to the
user (i.e. an FPI gets replaced with a PrettyVer).


>* if the former, I think we could use $File->{Version} only for the
>version attribute info, and using a new var for the "Document Type".

The variable is overloaded, yes. More granularity would probably be a good idea
here, but mind we don’t add too many more (essentially global vars) entries in
the $File hash.

The entirety of $File is as a faux “object”; IOW it allows us to not pass a
gazillion variables back and forth between subs, but at the price of essentially
defating Perl’s type and scope checking, and introucing a glkobal variable.

The intent is that it will become an actual object — where object variables are
actual individual variables, local to the object, and with get/set accessor
methods — during M12N.


That said, we might bear to have separate variables for each possible source of
document type info, plus one further var where we keep the aggregate value which
will be displayed to the user.

-- 
"A plague o' both your houses! I am sped." - Mercutio, kinsman to the Prince.
                   See Project Gutenberg <URL:http://promo.net/pg/> for more.

Received on Friday, 3 June 2005 01:20:48 UTC