Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2014-02-01

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
23:18 jeffreykegler joined #marpa
04:29 jeffreykegler joined #marpa
05:19 ronsavage joined #marpa
16:24 jeffreykegler joined #marpa
17:30 jeffreykegler I have finally discovered how to get Cweb comments in the style I like.
17:30 jeffreykegler Don Knuth's Cweb, of course, allows comments in the C code, but Don's preferences were formed in
17:31 jeffreykegler the days you wrote assembly code out long hand, on forms, and he prefers the comment to
17:31 jeffreykegler follow the code, on the same line, the way the old assembler comments did.
17:32 jeffreykegler If you read Knuth's code, he makes this style work well.
17:33 jeffreykegler But I am accustomed to a more modern style, where the C comment appears *before* the code it desribes, at the same identation level.
17:33 jeffreykegler When typeset (as it is in Cweb), I like some extra space before the comment.
17:34 jeffreykegler Now, I've hacked Cweb heavily.  For example, Cweb does not allow code blocks to break across pages -- Knuth always manages to keep his short.
17:35 jeffreykegler I think short is good, but mine start long, and often stay that way, so I changed Cweb so that page breaks occur in code pretty much the same as anywhere else.
17:38 jeffreykegler Another Cweb convention I hacked is the use of boldface in code.  Knuth uses boldface for language keywords ("for", "case", "switch") and normal weight for variables, which I think is exactly backwards ...
17:38 jeffreykegler so I hacked Cweb so that my variables are boldface and the language's keywords are normal weight.
17:41 jeffreykegler But one hack that has evaded me is how to get comments, because Cweb was always either eating my vertical space, or adding more, and similarly with the indentation.  There are lots of side effects, actions at a distance and hidden variables in TeX spacing, so that just directly asking for what you want does not work.
17:41 jeffreykegler Anyway, here, after years, is the solution:
17:42 jeffreykegler First, define a Tex macro: \def\comment{\par\medskip\6\4\4}
17:43 jeffreykegler Then, for the actual comment, do something like
17:43 jeffreykegler @t}\comment{@>/* For every Leo source link */
17:44 jeffreykegler This is actually even uglier than it looks at first glance.  The "@t" and "@>" mark the beginning and end of the an insertion of raw TeX into C code.
17:47 jeffreykegler Within the, the '}' and '{' tell Tex to end it's current block and start a new one.  (It's kind of a macro that spans blocks, which is a horrific hack, but apparently there is no clean way to do this.)
17:48 jeffreykegler For the actual \comment macro, it starts a paragraph, does a "medium" (6pt) skip, and then calls Cweb macros: First the one named "6", then the one named "4" twice.
17:49 jeffreykegler "6" does something magical which makes the spacing actually happen.
17:52 jeffreykegler The "4"'s backspace horizontally, so that the indentation comes out OK.  Again, another "magic" formula.
17:53 jeffreykegler Anyway, I've gone on at some length, but I often use TeX as an illustration of the industry tolerating languages with bad syntax.
17:54 jeffreykegler Not all the issues here are syntactic -- there's a lot of programming by side effects.  But when it comes to understanding the actions at a distance, the syntax throws up obstacles at every turn.
17:56 jeffreykegler For those of you who don't know TeX, this can serve as an illustration.  Those of you who do will know that I have *not* picked an extreme example.
18:14 ilbot3 joined #marpa
18:14 Topic for #marpa is now Current release: https://metacpan.org/pod/Marpa::R2   Source: https://github.com/jeffreykegler/Marpa--R2   public logs at http://irclog.perlgeek.de/marpa/today
19:17 jdurand Damned, this reminds me when I was doing TeX (later I moved to its grand-brother LaTeX), and the headaches associated! Well done!
20:46 ronsavage jeffreykeglet: Well done. Although I do feel a bit sad you've chosen to spend so much time on this. And do you see it (now?) tying in with other mark-up languages (or converters)?
20:50 jeffreykegler The time will pay off.  My immediate motive for coming back to this is working with the Libmarpa C code, and realizing how much easier it would be to write if I could write comments in the style that I felt comfortable with.  Now I can.
20:50 jeffreykegler Other the other hand, I also feel sad about that state of our programming tools.  So much time is being wasted and not just my time.
20:52 jeffreykegler ronsavage: In answer to your question, I don't see any tie-of my comment hack outside Cweb.
20:53 jeffreykegler There's a big difference in quality between tools that require parsing and those that don't.
20:54 jeffreykegler If you look at gdb, it's very easy to use.  It does everything but point a big red arrow at the mistake, at least by contrast to the C debuggers of the 1970's.
20:57 jeffreykegler gcc error messages on the other hand, have little improved over those of 1970's compilers.  I sometimes think they're worse, because it's the same parsing technology dealing with a slightly expanded syntax.
20:59 jeffreykegler gcc and gdb come from the same folks, and they address problems of similar difficulty.  gdb's domain, with all the object file formats, machine code layout, etc., etc., is extremely layered and complex, as much so as gcc's.
21:00 jeffreykegler But gdb improved much more over db than gcc's syntax error detection has over the earlier C compilers.
21:01 jeffreykegler I believe that the difference is because parsing has been an obstacle.
21:15 * jdurand is at the end of coding JavaScript regexp engine - tedious work
21:16 jeffreykegler Perhaps I should add something for those who did not work with the UNIX debuggers of the 1970's.  Half of the time they could not figure out enough to give you a stack trace, in which case they were nearly totally useless -- you could try to inspect the value of global variables (which we used in those days), but nothing else.
21:16 jeffreykegler jdurand: congratulations!
21:17 jeffreykegler So that means we have a Marpa-powered regexp engine coming soon?
21:19 jeffreykegler AFK for a few minutes
21:21 jdurand yes - but the JavaScript one - coding one of the roots of JavaScript I know now better than ever why people coding with it yells about its limitation
21:21 jdurand bypassing the limitations is easy, just few routines to change - but these limitations are by design - anyway, I am finishing the code and will do t/*t tomorrow at the latest
21:42 jeffreykegler jdurand: Sounds really good.
21:43 * jeffreykegler is off to lunch
22:45 ronsavage jdurand: Re JS design, compared the sizes of the 2 books: Any JS manual 'v' JavaScript: The Good Parts by Dougles Crockford (I've probably mentioned this before)?

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary