Re: dfmt 0.1.0

2015-03-07 Thread Russel Winder via Digitalmars-d-announce
On Sat, 2015-03-07 at 12:57 +, Kagamin via Digitalmars-d-announce wrote: > On Friday, 6 March 2015 at 20:22:42 UTC, Ben Boeckel wrote: > > And I find that monospace fonts tend to make it much easier to > > tell the > > difference between 'l', '1', and 'I'. Not so important in > > English, but

Re: dfmt 0.1.0

2015-03-07 Thread Russel Winder via Digitalmars-d-announce
On Sat, 2015-03-07 at 12:28 +0100, FG via Digitalmars-d-announce wrote: […] > > If at all, the problem with Phobos' style isn't with horizontal spacing but > vertical space. > Consider the waste of space below. Too much scrolling and I lose focus. Now, > *that* is really irritating. ;) […] This

Re: dfmt 0.1.0

2015-03-07 Thread Kagamin via Digitalmars-d-announce
On Friday, 6 March 2015 at 20:22:42 UTC, Ben Boeckel wrote: You're making assumptions about the features of your users' editors. These features are not trivial to implement Implementation of three different word wrapping algorithms in Scintilla took 52 lines of code. For comparison: a rudiment

Re: dfmt 0.1.0

2015-03-07 Thread ketmar via Digitalmars-d-announce
On Sat, 07 Mar 2015 13:03:06 +, Kagamin wrote: > In fact, I failed to find good monospace font for source code, it used > to be Courier New 9pt, but it works well only on displays no bigger than > 1024*768. terminus rocks. signature.asc Description: PGP signature

Re: dfmt 0.1.0

2015-03-07 Thread Kagamin via Digitalmars-d-announce
In fact, I failed to find good monospace font for source code, it used to be Courier New 9pt, but it works well only on displays no bigger than 1024*768.

Re: dfmt 0.1.0

2015-03-07 Thread Kagamin via Digitalmars-d-announce
On Friday, 6 March 2015 at 20:22:42 UTC, Ben Boeckel wrote: And I find that monospace fonts tend to make it much easier to tell the difference between 'l', '1', and 'I'. Not so important in English, but it can be all the difference in code. http://abload.de/img/tmpr3uv6.png I see no less diff

Re: On fonts and editors [was dfmt 0.1.0]

2015-03-07 Thread Stefan Koch via Digitalmars-d-announce
On Saturday, 7 March 2015 at 07:20:01 UTC, Russel Winder wrote: They are hamstrung by the continued obsession with the text file as the primary unit of editing. As soon as they and programmer users get over this, the sooner we can get on with better UX for development. I agree.

Re: dfmt 0.1.0

2015-03-07 Thread FG via Digitalmars-d-announce
On 2015-03-07 at 07:51, Russel Winder via Digitalmars-d-announce wrote: Many C++ > projects are returning to it, Go enforces it if you let it, many Python projects are starting to use it in spite of PEP-8. Now, that you mentioned Python, it was one of the main reasons why I moved away from tab

Re: dfmt 0.1.0

2015-03-07 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 10:43 PM, Russel Winder via Digitalmars-d-announce wrote: The difficulty here is turning a personal preference into a social orthodoxy. A consistent style is necessary for Phobos. For your own projects, D doesn't dictate any particular style.

Re: On fonts and editors [was dfmt 0.1.0]

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 15:22 -0500, Ben Boeckel via Digitalmars-d-announce wrote: […] > > Well it is now more apparent with more quoting. It now appears that the > first block is using 3-space indents while the bottom looks just fine > even with the quote markers. But there is no semantic differen

Re: dfmt 0.1.0

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 18:21 -0800, Walter Bright via Digitalmars-d-announce wrote: > On 3/6/2015 2:31 AM, Russel Winder via Digitalmars-d-announce wrote: > > Remember a tab is not a number of spaces, it is semantic markup. > > All I can say is good luck with that. ASCII is not a markup language, a

Re: dfmt 0.1.0

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 18:31 -0800, Walter Bright via Digitalmars-d-announce wrote: […] > > Unlike english prose, code follows patterns. With a monospace font, one can > line > up those patterns which makes for easier visual checking for errors. That works for you fine, but it doesn't work for m

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 11:55 AM, Russel Winder via Digitalmars-d-announce wrote: The core problem here is teletype, monospace font thinking. Using a proper proportional font for you code and you rapidly lose the need for all this alignment stuff. Unlike english prose, code follows patterns. With a monos

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 1:48 AM, Brian Schott wrote: The serious answer is that there's a lot of special casing that I'm still trying to figure out. Ah. I had thought that maybe there was an obvious algorithm I didn't think of!

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 2:47 AM, Stefan Koch wrote: I'd like to hear your definition of simple. It's easy to understand, and one could write one from scratch over a weekend. I haven't done any statistics, but I'd bet that that parse.c & lexer.c are among the most stable parts of dmd judging by change his

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 1:54 AM, Brian Schott wrote: On Friday, 6 March 2015 at 09:39:13 UTC, Walter Bright wrote: True, but on the other hand, a D lexer and parser are pretty simple. Did you mean "simple compared to C++"? It's simple in both absolute terms and relative to C++ terms. It's not as simple

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/6/2015 2:31 AM, Russel Winder via Digitalmars-d-announce wrote: Remember a tab is not a number of spaces, it is semantic markup. All I can say is good luck with that. ASCII is not a markup language, and trying to reinvent it as one is doomed to failure. I can also say from experience th

Re: dfmt 0.1.0

2015-03-06 Thread Ben Boeckel via Digitalmars-d-announce
On Fri, Mar 06, 2015 at 19:55:10 +, Russel Winder via Digitalmars-d-announce wrote: > On Fri, 2015-03-06 at 09:54 -0500, Ben Boeckel via > Digitalmars-d-announce wrote: > > -int foo(int bar) { > > - return bar; > > -} > > > > versus (assuming 8 space indents): > > > > -int foo(int bar)

Re: dfmt 0.1.0

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 09:54 -0500, Ben Boeckel via Digitalmars-d-announce wrote: > On Fri, Mar 06, 2015 at 10:31:29 +, Russel Winder via > Digitalmars-d-announce wrote: > > That is the whole point of using tabs for indent, you can chose the > > indent amount: I tend to use 20ex. > > > > Reme

Re: dfmt 0.1.0

2015-03-06 Thread Ben Boeckel via Digitalmars-d-announce
On Fri, Mar 06, 2015 at 10:31:29 +, Russel Winder via Digitalmars-d-announce wrote: > That is the whole point of using tabs for indent, you can chose the > indent amount: I tend to use 20ex. > > Remember a tab is not a number of spaces, it is semantic markup. Using > spaces is a low-level h

Re: dfmt 0.1.0

2015-03-06 Thread Stefan Koch via Digitalmars-d-announce
On Friday, 6 March 2015 at 09:39:13 UTC, Walter Bright wrote: On 3/5/2015 1:04 AM, Russel Winder via Digitalmars-d-announce wrote: It would be good if the D implemented D parser were though. Parsing to create an AST is needed for many things. If each tool in the tool chain implements it's own…

Re: dfmt 0.1.0

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 09:48 +, Brian Schott via Digitalmars-d-announce wrote: > On Friday, 6 March 2015 at 09:40:07 UTC, Walter Bright wrote: > > How are comments handled? > > The source code makes a DC 15 wisdom save, if it fails then the > comments get distributed randomly. But with a d4

Re: dfmt 0.1.0

2015-03-06 Thread Russel Winder via Digitalmars-d-announce
On Fri, 2015-03-06 at 01:37 -0800, Walter Bright via Digitalmars-d-announce wrote: > On 3/5/2015 7:15 PM, Brian Schott wrote: > > You probably feel that way because tabs are better. dfmt only > > defaults to spaces > > because that's what's in the Phobos style guide. > > Spaces are used in Phobo

Re: dfmt 0.1.0

2015-03-06 Thread Brian Schott via Digitalmars-d-announce
On Friday, 6 March 2015 at 09:39:13 UTC, Walter Bright wrote: True, but on the other hand, a D lexer and parser are pretty simple. Did you mean "simple compared to C++"? I remember having to report/fix a LOT of bugs in the language specification and explore the DMD front end source code to ge

Re: dfmt 0.1.0

2015-03-06 Thread Brian Schott via Digitalmars-d-announce
On Friday, 6 March 2015 at 09:40:07 UTC, Walter Bright wrote: How are comments handled? The source code makes a DC 15 wisdom save, if it fails then the comments get distributed randomly. The serious answer is that there's a lot of special casing that I'm still trying to figure out.

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/3/2015 3:03 PM, Brian Schott wrote: dfmt works by re-using my existing lexer and parser. The parser is run on the code first so that the formatting step knows a few things like the difference between the binary and unary forms of "*". Line splitting is figured out using a badly mangled versi

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/5/2015 1:04 AM, Russel Winder via Digitalmars-d-announce wrote: It would be good if the D implemented D parser were though. Parsing to create an AST is needed for many things. If each tool in the tool chain implements it's own… it just seems wrong. True, but on the other hand, a D lexer a

Re: dfmt 0.1.0

2015-03-06 Thread Walter Bright via Digitalmars-d-announce
On 3/5/2015 7:15 PM, Brian Schott wrote: You probably feel that way because tabs are better. dfmt only defaults to spaces because that's what's in the Phobos style guide. Spaces are used in Phobos because no two tools agree on what the tab size should be.

Re: dfmt 0.1.0

2015-03-06 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-03-05 13:10, Daniel Murphy wrote: It isn't, but it's slowly getting better. eg You can now build the lexer as a library without pulling everything else in. Yes, that is absolute fantastic as a first step. It's quite possible that in a couple of years it will be in a state where it's

Re: dfmt 0.1.0

2015-03-05 Thread Brian Schott via Digitalmars-d-announce
On Thursday, 5 March 2015 at 09:02:25 UTC, Russel Winder wrote: Since using Go and working on a couple of fairly old C++ codebases, all of which use tab for indent, I have come to rather like it. You probably feel that way because tabs are better. dfmt only defaults to spaces because that's w

Re: dfmt 0.1.0

2015-03-05 Thread Daniel Murphy via Digitalmars-d-announce
"Jacob Carlborg" wrote in message news:md8vu6$hc1$1...@digitalmars.com... The DMD front end is not really designed to be used as a library for tooling. It isn't, but it's slowly getting better. eg You can now build the lexer as a library without pulling everything else in. It's quite possi

Re: dfmt 0.1.0

2015-03-05 Thread Russel Winder via Digitalmars-d-announce
On Thu, 2015-03-05 at 08:17 +0100, Jacob Carlborg via Digitalmars-d-announce wrote: > On 2015-03-04 16:26, Russel Winder via Digitalmars-d-announce wrote: > > > There ought to be for the compiler/formatter toolchain otherwise > > there will be problems. And if there is a D parser as library and

Re: dfmt 0.1.0

2015-03-05 Thread Russel Winder via Digitalmars-d-announce
On Wed, 2015-03-04 at 21:22 +, Brian Schott via Digitalmars-d-announce wrote: > […] > > That means that the Emacs plugin needs to start it automatically. Is this something on your todo list, or do you need a pull request? > Implementing a separate parser based on the language spec has > h

Re: dfmt 0.1.0

2015-03-04 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-03-04 16:26, Russel Winder via Digitalmars-d-announce wrote: There ought to be for the compiler/formatter toolchain otherwise there will be problems. And if there is a D parser as library and it works why would anyone want another parser? The DMD front end is not really designed to be

Re: dfmt 0.1.0

2015-03-04 Thread Brian Schott via Digitalmars-d-announce
On Wednesday, 4 March 2015 at 15:26:51 UTC, Russel Winder wrote: I try to use DCD when working with Emacs for D code, but I keep forgetting to start the server :-( I would certainly be happy to commit to using dfmt just as I use gofmt in Emacs. As long as the variation from my preferred style i

Re: dfmt 0.1.0

2015-03-04 Thread Russel Winder via Digitalmars-d-announce
On Wed, 2015-03-04 at 15:04 +, Dicebot via Digitalmars-d-announce wrote: […] > All Brian tools use the same libdparse. Those include DCD, > DScanner, dfix, dfmt and probably some others I am not aware of. > It was also proposed for inclusion into Phobos a while ago but > review pressure was

Re: dfmt 0.1.0

2015-03-04 Thread Dicebot via Digitalmars-d-announce
On Wednesday, 4 March 2015 at 14:53:22 UTC, Russel Winder wrote: On Wed, 2015-03-04 at 14:21 +, Dicebot via Digitalmars-d-announce wrote: […] No. https://github.com/Hackerpilot/libdparse Well this a bit not efficient, one D parser written in D for the compiler and a separate D parser wri

Re: dfmt 0.1.0

2015-03-04 Thread Russel Winder via Digitalmars-d-announce
On Wed, 2015-03-04 at 14:21 +, Dicebot via Digitalmars-d-announce wrote: […] > > No. https://github.com/Hackerpilot/libdparse Well this a bit not efficient, one D parser written in D for the compiler and a separate D parser written in D for the code formatter. What can go wrong. -- Russel.

Re: dfmt 0.1.0

2015-03-04 Thread Dicebot via Digitalmars-d-announce
On Wednesday, 4 March 2015 at 07:43:44 UTC, Russel Winder wrote: On Tue, 2015-03-03 at 23:03 +, Brian Schott via Digitalmars-d-announce wrote: […] dfmt works by re-using my existing lexer and parser. The parser is run on the code first so that the formatting step knows a few things lik

Re: dfmt 0.1.0

2015-03-03 Thread Russel Winder via Digitalmars-d-announce
On Tue, 2015-03-03 at 23:03 +, Brian Schott via Digitalmars-d-announce wrote: > […] > dfmt works by re-using my existing lexer and parser. The parser is > run on the code first so that the formatting step knows a few > things like the difference between the binary and unary forms of > "

Re: dfmt 0.1.0

2015-03-03 Thread ketmar via Digitalmars-d-announce
On Tue, 03 Mar 2015 12:35:44 -0800, Walter Bright wrote: > On 2/19/2015 6:21 PM, Brian Schott wrote: >> dfmt is a D source code formatting tool. >> >> https://github.com/Hackerpilot/dfmt/ >> https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 > > Thanks for doing this. It's an important part

Re: dfmt 0.1.0

2015-03-03 Thread Brian Schott via Digitalmars-d-announce
On Tuesday, 3 March 2015 at 20:36:20 UTC, Walter Bright wrote: Thanks for doing this. It's an important part of the D toolchain we need to have. At some point I want to merge it into the official release. I noticed it is remarkably small (1400 lines). What is its algorithm? How does it compar

Re: dfmt 0.1.0

2015-03-03 Thread Walter Bright via Digitalmars-d-announce
On 2/19/2015 6:21 PM, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Thanks for doing this. It's an important part of the D toolchain we need to have. At some point I want to merge it in

Re: dfmt 0.1.0

2015-02-22 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-02-22 19:52, qznc wrote: Congratulations to releasing. :) For the record, I think using a D parser in dfmt is a dead end. Surely, for certain cases the additional information is necessary. However, it restricts dfmt to only format syntactically valid snippets. This means you cannot (in

Re: dfmt 0.1.0

2015-02-22 Thread qznc via Digitalmars-d-announce
On Sunday, 22 February 2015 at 09:07:16 UTC, Brian Schott wrote: On Sunday, 22 February 2015 at 08:48:16 UTC, Brian Schott wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Ha

Re: dfmt 0.1.0

2015-02-22 Thread via Digitalmars-d-announce
On Sunday, 22 February 2015 at 09:07:16 UTC, Brian Schott wrote: On Sunday, 22 February 2015 at 08:48:16 UTC, Brian Schott wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Ha

Re: dfmt 0.1.0

2015-02-22 Thread Daniel Murphy via Digitalmars-d-announce
"Brian Schott" wrote in message news:updwbngwrilngxhun...@forum.dlang.org... dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Is this on code.dlang.org? I can't find it.

Re: dfmt 0.1.0

2015-02-22 Thread Brian Schott via Digitalmars-d-announce
On Sunday, 22 February 2015 at 08:48:16 UTC, Brian Schott wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 I just tagged 0.1.1. The only

Re: dfmt 0.1.0

2015-02-22 Thread Brian Schott via Digitalmars-d-announce
On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 I just tagged 0.1.1. The only change is a bug fix for a case where certain long lines with par

Re: dfmt 0.1.0

2015-02-20 Thread Brian Schott via Digitalmars-d-announce
On Friday, 20 February 2015 at 23:00:25 UTC, Brad Anderson wrote: From what I understand they implemented a LaTeX style weighted line breaker which would explain why it works so much better than a typical code formatter. It's very smart about how it does line breaks. This seems to make all the

Re: dfmt 0.1.0

2015-02-20 Thread Brad Anderson via Digitalmars-d-announce
On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Great! I've been using clang-format lately for my C++ code and it's really blown me away how

Re: dfmt 0.1.0

2015-02-20 Thread Jacob Carlborg via Digitalmars-d-announce
On 2015-02-20 03:21, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 I looked at the tests, in particular "contracts.d.ref". I would expect an empty newline between an instance variable a

Re: dfmt 0.1.0

2015-02-20 Thread Tourist via Digitalmars-d-announce
On Friday, 20 February 2015 at 05:53:32 UTC, Brian Schott wrote: On Friday, 20 February 2015 at 05:23:45 UTC, Joakim wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpi

Re: dfmt 0.1.0

2015-02-19 Thread Joakim via Digitalmars-d-announce
On Friday, 20 February 2015 at 05:53:32 UTC, Brian Schott wrote: On Friday, 20 February 2015 at 05:23:45 UTC, Joakim wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpi

Re: dfmt 0.1.0

2015-02-19 Thread Brian Schott via Digitalmars-d-announce
On Friday, 20 February 2015 at 05:23:45 UTC, Joakim wrote: On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Thanks, you should list some of the

Re: dfmt 0.1.0

2015-02-19 Thread Joakim via Digitalmars-d-announce
On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Thanks, you should list some of the formatting changes it makes in the README.

Re: dfmt 0.1.0

2015-02-19 Thread MartinNowak via Digitalmars-d-announce
On Friday, 20 February 2015 at 02:21:01 UTC, Brian Schott wrote: https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0 Congrats, I found the reformatting a bit harsh from time to time, but it's a good opportunity to finally settle style discussions.

dfmt 0.1.0

2015-02-19 Thread Brian Schott via Digitalmars-d-announce
dfmt is a D source code formatting tool. https://github.com/Hackerpilot/dfmt/ https://github.com/Hackerpilot/dfmt/releases/tag/v0.1.0