public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: Alex Shaw <alex.shaw.as-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: What if pandoc were rewritten today?
Date: Fri, 01 Oct 2021 09:16:49 -0700	[thread overview]
Message-ID: <m2zgrsoh3i.fsf@Johns-Air.hsd1.ca.comcast.net> (raw)
In-Reply-To: <1784a254-0585-4f1f-a3b9-e8331fdcac1fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


You have to remember that I started writing pandoc solely to play
with Haskell. (In fact, I only knew the bare basics of Haskell
when I started.)  So, my goal was to have fun writing a lot of
Haskell, and that goal is hard to achieve using another language.
(Also, because this was my goal, I wasn't bothered by the fact
that when I started, Haskell didn't have much of a library
ecosystem.  I just wrote the libraries I needed: zip-archive,
skylighting, texmath, unicode-collation, doclayout, doctemplates,
ipynb...)

That said, Haskell has proven to be an excellent choice for this
project.  The strong type system makes refactoring easy, and
helps me avoid whole classes of fiddly bugs that would torment
me in languages like C or JavaScript. The ability to guarantee
that functions have no side effects is also extremely helpful.
And the parsec parser combinator library makes it easy to create
flexible parsers for even the most irregular syntaxes.

There are lots of things I'd probably do differently if I were
starting from scratch.  I probably would have built the AST
around sequences rather than lists.  (Currently we can work
with sequences in the Builder abstraction, but why not just
make the AST work that way?)  I would have set things up so
that every AST element can have attributes (#684).  I would have
used types more heavily (e.g. in Format and Attributes).
Probably I would have done without a Space constructor on
Inline (#7579).  I would have added a Figure type (#3177).  I
would have separated some core functionality into a separate
package (#6215).  Ideally, support for different syntaxes could
also be split into separate packages so that people could take
what they need (however, this has to be balanced against the
convenience for the developer of having everything in the same
package). As you can see, most of these things are still planned
changes.  Fortunately, Haskell's strong type system makes it
possible to  make changes like this across a large code base
without going crazy.


Alex Shaw <alex.shaw.as-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello. This is my first post, so I apologize if I'm doing anything wrong.
>
> I have a question/topic for conversation for John MacFarlane and any other 
> long-time pandoc contributors:
>
> *If you were to start over from scratch today, what would you do 
> differently?*
>
> If pandoc were never invented back in 2006, what are some different choices 
> you would make today?
> Would you use a different language (C++, Rust, Python)?
> Different Haskell features (prefer Functors over Monads)?
> Internal design architecture (completely re-written AST)?
> Source-code structure (merge readers and writers so that each file format 
> is specified in a single module instead of each file format being partially 
> duplicated in a reader and a writer implementation)?
>
> Those are all just examples. Feel free to share whatever you like.
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1784a254-0585-4f1f-a3b9-e8331fdcac1fn%40googlegroups.com.


      parent reply	other threads:[~2021-10-01 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 11:51 Alex Shaw
     [not found] ` <1784a254-0585-4f1f-a3b9-e8331fdcac1fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-10-01 16:16   ` John MacFarlane [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2zgrsoh3i.fsf@Johns-Air.hsd1.ca.comcast.net \
    --to=jgm-tvlzxgkolnx2fbvcvol8/a@public.gmane.org \
    --cc=alex.shaw.as-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).