http://qs321.pair.com?node_id=17506


in reply to rambling (deux)

I don't think we need line numbering. In the Code catacombs, there already is automatic line numbering, and for the rest of the sections, automatic line numbering would be confusing since there is no way to reference line numbers from the text. Two examples :

Here we have the trivial hello world program :

1: #!/usr/bin/perl -w 2: print "Hello World\n"; 3: exit 0;
And here we have another way to do it :
4: #!/usr/bin/perl -w 5: print << X 6: Hello World 7: X

In the above case, restarting line numbering would have been the right thing, as the above code are really two programs. But always restarting line numbering is also a bad idea :

First, we need to include some modules and pseudo-modules :

1: use strict; 2: use warnings; 3: use IO::Socket;
and now we need to predeclare some variables and initialize our defaults :
1: my $port, $host; 2: $host = shift || "localhost"; 3: $port = shift || 8000;
Here, it would be better to have the line numbers continue.

As for the syntax highlighting, currently the <CODE>-tags are used for almost all preformatted stuff, also for HTML stuff etc., but maybe it would be interesting to have syntax highlighting. But from what I see, syntax highlighting is far from trivial, since you will more or less need a Perl parser for that, as Perl cannot be parsed by line or by keywords, and strings have at least three different possibilitie

Replies are listed 'Best First'.
RE: RE: rambling (deux)
by ar0n (Priest) on Jun 11, 2000 at 00:58 UTC
    oops, i guess i should read perlmonks.org a little more! thanks :-)