bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dlang: initial changes to run the calc tests on it


From: H. S. Teoh
Subject: Re: dlang: initial changes to run the calc tests on it
Date: Fri, 1 Mar 2019 11:01:16 -0800
User-agent: Mutt/1.10.1 (2018-07-13)

[Btw, no need to Cc: me in replies, as I'm subscribed to bison-patches]

On Fri, Mar 01, 2019 at 06:46:43AM +0100, Akim Demaille wrote:
> Hi!
> 
> > Le 1 mars 2019 à 03:10, H. S. Teoh <address@hidden> a écrit :
[...]
> > In the ideal case, the lexer would simply be a struct that wraps
> > around an arbitrary input range of characters.  In order to make
> > things work with the current code, though, I conceded to make
> > CalcLexer a class that implements Lexer.  We can change that when we
> > get around to moving away from lexer classes.
[...]
> The version you sent works, thanks!  Is it ok if I install it under
> your name?  The work is yours, not mine:  (add there's a question
> for you afterwards).

That's fine.


> (For the records, the GNU Coding Standards require a space before
> the parens in function calls.  But the GCS were written because there
> are too many styles in C/C++, and you have to pick one.  If the same
> dissonance hits D, then let's stick to the GCS.  However, if there
> is one "true" style in D, tell me and let's stick to it.)

There isn't really "one true style" in D, though there is the Phobos
(standard library) style guide described here:

        https://dlang.org/dstyle.html

This style is really only adhered to in Phobos, and not many D
programmers follow it.  I follow it myself (though I diverge on some
minor points), mainly because I occasionally contribute to Phobos and
it's much easier to just use the style for my own code than to have to
switch between styles depending on which project I'm working on.

So it's really a judgment call whether we should stick to GCS or to
Phobos style.  I have no strong opinions either way. (Though I have to
admit, 2-space indentation is a bit extreme... I can work with it,
though.  I used to write Perl with 3-space indentation, and I *have*
seen code with 1-space indentation before. So it's not that big of a
deal.)


[...]
> I think we should also expose a simpler API to build the scanner
> from a File, *in addition* to the range based one?  Just as a
> convenience wrapper.  WDYT?

Certainly!  It would make the example look a lot less scary. :-D  See
updated calc.y (attached).


T

-- 
There are two ways to write error-free programs; only the third one works.

Attachment: calc.y
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]