regex version pull request: https://github.com/dlang/dub/pull/869
On Wed, Jun 8, 2016 at 8:50 PM, Rory McGuire <[email protected]> wrote: > On Wed, Jun 8, 2016 at 11:15 AM, Sönke Ludwig > <[email protected]> wrote: >> Am 08.06.2016 um 08:59 schrieb Jacob Carlborg: >>> >>> On 2016-06-07 20:42, Sönke Ludwig wrote: >>> >>>> No, it has to be the "+" variant (the first /+ +/ comment is evaluated). >>> >>> >>> That's unfortunate. >> >> >> I generally really do appreciate your critique, but without backing reasons >> it doesn't really have a constructive effect. >> >> Two good properties about restricting to /+ +/ is that it's still possible >> to put something else in front of it, and that it stands out from the usual >> /* */ comments. Sure arguments can be made for supporting all comment types, >> but it shouldn't be forgotten that in the end this is a question of >> absolutely minimal impact. >> >> Just to be clear: If anyone has a good argument for supporting more/all >> comment types and there are no equally good arguments against it, please go >> ahead and implement it and it will be included. Let's just make this a quick >> decision, because changing it later on will mean breakage no matter how it's >> done. > > The only thing I can think to change would be that it doesn't have to > be the _first_ '/+...' but rather the first regex: > \n\/\+\s*dub\.(sdl|json):?\n(.*)\n\+\/\n > > See [0] for regex in action on the code below. > > Sometimes we might want to put the dub config just above the main > function, and a lot of people like that to be at the bottom of the > file (who knows what comments might be above that and we wouldn't want > to break the way /+ ... +/ can be used anywhere to comment out code / > comments. > > concrete example: > #!/usr/bin/env dub > /** > * Copyright (C) blah blah blah > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > * Some long copyright notice > */ > /+ > // Example and/or documentation on changing this program > Some codeSome codeSome codeSome code > Some codeSome codeSome codeSome code > /* > * Note that when doing the below !not threadsafe!... > * see next example for threadsafe version. > */ > Some codeSome codeSome codeSome code > Some codeSome codeSome codeSome code > Some codeSome codeSome codeSome code > Some codeSome codeSome codeSome code > /* > * This is the threadsafe version of above both are provided. > * threadsafe version is not quite as fast > */ > Some codeSome codeSome codeSome code > Some codeSome codeSome codeSome code // this line has to be here > Some codeSome codeSome codeSome code > > +/ > > /+ dub.sdl: > name "colortest" > dependency "color" version="~>0.0.3" > +/ > > // implementation of support functions > > void main(string[] args) { > ... > } > > > [0] https://regex101.com/r/dR7xY1/1
