From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29324 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: What if pandoc were rewritten today? Date: Fri, 01 Oct 2021 09:16:49 -0700 Message-ID: References: <1784a254-0585-4f1f-a3b9-e8331fdcac1fn@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5928"; mail-complaints-to="usenet@ciao.gmane.io" To: Alex Shaw , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBB77I3SFAMGQEV5ALQGA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Oct 01 18:17:06 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f189.google.com ([209.85.167.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mWLDe-0001Jn-EU for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 01 Oct 2021 18:17:06 +0200 Original-Received: by mail-oi1-f189.google.com with SMTP id m11-20020aca650b000000b0027625c6a441sf6639589oim.15 for ; Fri, 01 Oct 2021 09:17:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633105024; cv=pass; d=google.com; s=arc-20160816; b=qBM9xYGDu7Bcf1cIMgba+KaLVEG6QUfjvwOyRHEeT4GCY9WhDWXvY0x4UnaUtS8ln9 OutMulAc7aBEqaGP27MWWQmG7Q9ztrlHaubDai+cfafMIE61oxvqO/50W97zres5sKcY TTiNPRaZdClju7AdJl0z6tbhJybX6d1cGKQDn7IHSn3gEGp+VkZLla/+UdqTfAgetPo5 dpkBdGHVvVRb+W9SlVY/+z6iNzgYp9XFDxFsFYuqjg2Sy3gSrtdzCwqwM/toDUn9oYId CkuI8Hjz/NTZg02eKTnlsJhdUMIIvIB49VmHyPrvdt7gvSsZnWUWVWy3gmp1BMwTbCC4 DA6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:message-id :date:references:in-reply-to:subject:to:from:sender:dkim-signature; bh=aeTklOPnZYa2NEA2oaYlCDcQlzPorfyoPJvjEUNB2I8=; b=X6WYn7IVraW6CTk8xiuzBV9bl3eB2/CkxWpuDy3q+dtsnCFsdZLBYLpG4x39Q4OwQf xm1nDjHnMDsm6WdWQOYyR7tASx//zplxhcjZoQxqtlhdXzfwEBoWRotvHYB09Iq516S5 tbW+xY2XC36qV/GhHmg/87TxJPgRikKQedrSGY8IPzVvWmgR5wrE0kzv9LgGZqd4t5Sd aKc20OSNeUAbEX6uUYGvhHoZE9NxABm5jzG3Kaz/974yBgMYHpVN3UxtEwTVpnJN4p3b SeaAIqbWRbWpVku6PUUR+rUuribkgDBIpEvgMpVEuKQb/dehERFoRP1JyLd+Zoe0ER03 4m6Q== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=XDhAZY3F; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::1029 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=aeTklOPnZYa2NEA2oaYlCDcQlzPorfyoPJvjEUNB2I8=; b=peI60DP6HtUbuKeyKNzirTrr6tHjBzVuV0VZCqwe3oJioI5wKGzseHa67RHEM7XdyG vHhbouDtf3kfesv26skblINqg9y6ZLn4JEQajyThnKiKb8P+V4kGwA5svmYFoemZjDeF 4z3QMv07qR+dOEJtLG4AbHvUYye9c+M37kfRkFbiNZMOlViRPcHlJFqRiAA6tWYYdvuW hZMcS6OOcSq8Xh+F9WMVSqIFjAaxuM9WR8g3CcK1BA9JHjBOOXHAcUaZTRhvI6A+E0mM YxZwS6lGZUJXEDRZqKFWCxDbjH8h8ZhZaP5sgHBJ6/OmmkjxVoURkkkNyfW85VOwCxSw Im+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=aeTklOPnZYa2NEA2oaYlCDcQlzPorfyoPJvjEUNB2I8=; b=BO2G0PAjZaMG+pl2KCg1B+UTr/tpNnyAWur0KQ1ykhRsefKBktEReZ1+FJTt+uU4t7 qWB/LKBnabJi+f728hC9Pjb4EGpbkALCRSto/WTvY30Pxwpmyqo03s0zx5WnP2KVp23T ieBkZeJGYTaVdJW7Ohb1+WOw+syjDhcKblbdas6EWm4Ym0cL/KQaRe+ux4OynHYNNQ+B 855gNQZNxX85iQgHFTee2gSrcQthC52mtNceqcosZrbyQZC2gfly9wAQdqFaqI4SLRfm 5TYFcv+hYjiEHWwODNIUI7MRSBQSBgQLxAizhnKNSYAFO8BdnPyULevSvocBEWxpWWtV Ndtw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532zHam0cwz5cgI92syJPZqTrvzuHKQMyJupYnYTNvhixB4BNXU2 6jLFg99xF4ffMgqtObTlgps= X-Google-Smtp-Source: ABdhPJycYFrB41teZ2Bk6t58K/BPcVRp6QhStHfvxILRfDk1XOmCXnOIgrgFryVEqb9acGH55wuqjg== X-Received: by 2002:a9d:738b:: with SMTP id j11mr10788141otk.194.1633105024850; Fri, 01 Oct 2021 09:17:04 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:25a:: with SMTP id m26ls3176263oie.6.gmail; Fri, 01 Oct 2021 09:17:03 -0700 (PDT) X-Received: by 2002:a05:6808:1211:: with SMTP id a17mr4402748oil.91.1633105023496; Fri, 01 Oct 2021 09:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633105023; cv=none; d=google.com; s=arc-20160816; b=sah8TkfpmON6CzB3YaLBGQ4li6NYLlasKY/Y6PjeVdbi7F6/CMdg7AG7xA2iDI3I0g RRdisUVkDxP0VBrrtXrqsCjb+z0W7EOu/2CWeVPQrMUDETajhG5dRZSTbOtAATfUQuWF HZhqn8EiANYrDamc5ho1xe3s/xoqjbPRpl1OW8qmOPGmbEj/8FyQxxpCjpCr2Tz2Uck3 kKiDzCb/EfQNfjT/QEp5uTEzyI78wiIhfIzDTfIUw4HRtl3KMKQbnGRRs6cKp2oRgJQL rHqlZq7t2L/TovM8yJpuQKZ5ye8auTAISjzi0B4hmje7BCxZ9KMP100fm9F/7rQtXHTv +GtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=hwSi48veCqOhYoY98nk4ZDL0Mo8gps3z8Qk4xyrrNWA=; b=dD+at6yFOhNMnd8jG12hm6dl2JJYXW3VVL6XHsRUAUqFJMhRJCqOA7264Q6iMRF+2A v3l6SvgYcCFr3uUak/W+CUo3OoeFndAeVPvaZZ9Gw0V+wrflew/weTD4iBx+1W4+qTYn ogZO41qFC1bmBeV+gRI2l9rJ4f9wq3S8OQ/cPg8WBxjqxbb1VMFyITHCtBp5uaQ2rXNv JShk9ySz8XHSty5rXHrdgUET0iSr+gva2icyOGjF/S3UTaWwmXkZOEF8fQRbohQeqUEn G8X4WEMrAnzkp9ZiZ4IiGr9sCG1TNWaT04XLaeNfrK5aL3sRfyU2rrD4nZ8+fWQVfG02 49KA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=XDhAZY3F; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::1029 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com. [2607:f8b0:4864:20::1029]) by gmr-mx.google.com with ESMTPS id bi42si1140336oib.4.2021.10.01.09.17.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Oct 2021 09:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::1029 as permitted sender) client-ip=2607:f8b0:4864:20::1029; Original-Received: by mail-pj1-x1029.google.com with SMTP id rj12-20020a17090b3e8c00b0019f88e44d85so616811pjb.4 for ; Fri, 01 Oct 2021 09:17:03 -0700 (PDT) X-Received: by 2002:a17:902:c193:b0:13e:8e77:6c82 with SMTP id d19-20020a170902c19300b0013e8e776c82mr2020947pld.29.1633105022442; Fri, 01 Oct 2021 09:17:02 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id fz20sm3270840pjb.31.2021.10.01.09.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 09:17:00 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 92895A1A8; Fri, 1 Oct 2021 12:16:49 -0400 (EDT) In-Reply-To: <1784a254-0585-4f1f-a3b9-e8331fdcac1fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20210112.gappssmtp.com header.s=20210112 header.b=XDhAZY3F; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::1029 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:29324 Archived-At: 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 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.