February 26, 2014
On Tuesday, 25 February 2014 at 19:37:04 UTC, Walter Bright wrote:
> This is a most interesting idea. Please pursue.

I talked about it a little while ago  in a thread on the forum (it was also my dconf submission but since I don't really want to travel anyway that surely won't happen).

http://forum.dlang.org/thread/majnjuhxdefjuqjlpbmv@forum.dlang.org

The basic thing is to change object.d's RTInfo template to import an empty module and mixin a name. Projects would be able to override it by just writing their own module with the same name instead. Then, the compiler goes looking and prefers the user's one from the one in druntime.

It's doable right now, but we could improve it by adding an rtinfo like thing for modules too, or maybe even functions.

Some related bugzillas to rtinfo:

add it for modules too:
https://d.puremagic.com/issues/show_bug.cgi?id=10023

some bugs:
https://d.puremagic.com/issues/show_bug.cgi?id=10442
https://d.puremagic.com/issues/show_bug.cgi?id=10786

add it for built-in types too (not strictly necessary here)
https://d.puremagic.com/issues/show_bug.cgi?id=11670


I would *love* to have access to the call stack and local variables too, then we can do custom things a la @safe in the lib too. But I think we can go one step at a time, checking user structs and classes is possible today and gives some good possibilities.


Among the things I've done in my proof of concept:

rtinfo.d:
module core.rtinfo;
mixin template ProjectRtInfo(T) {
   import lint.virtuals;
   static assert(virtualCheck!T);
}

test.d:
import lint.virtuals;

class Foo {
        void foo() {}
}


$ dmd test53 virtuals.d  rtinfo.d
Warning Foo.foo is virtual

test.d:
import lint.virtuals;

class Foo {
        @virtual void foo() {}
}
$ dmd test53 virtuals.d  rtinfo.d
# works!
February 26, 2014
On Tuesday, 25 February 2014 at 23:40:02 UTC, Andrei Alexandrescu wrote:
> On 2/25/14, 3:22 AM, bearophile wrote:
>> Andrei Alexandrescu:
>>
>>> http://www.reddit.com/r/programming/comments/1yts5n/facebook_open_sources_flint_a_c_linter_written_in/
>>>
>>
>> An interesting comment from Reddit:
>>
>> klusark>I've been trying to build this for the past hour. It requires
>> folly. folly requires some "double-conversion" library, but you can't
>> use the default version, you have to build it with scripts from folly's
>> source. After I finally get folly to get past configure stage I get some
>> random python error in one of the build scripts. I just gave up at this
>> point. I'm sure I could get it working, but the time isn't worth it.<
>>
>> Bye,
>> bearophile
>
> Ironically that's for the obsoleted C++ program. The D program is trivial to build.
>
> Andrei

You should make that clearer in the README
February 26, 2014
On 2/25/14, 3:58 PM, Brad Anderson wrote:
> On Tuesday, 25 February 2014 at 23:40:02 UTC, Andrei Alexandrescu wrote:
>> On 2/25/14, 3:22 AM, bearophile wrote:
>>> Andrei Alexandrescu:
>>>
>>>> http://www.reddit.com/r/programming/comments/1yts5n/facebook_open_sources_flint_a_c_linter_written_in/
>>>>
>>>>
>>>
>>> An interesting comment from Reddit:
>>>
>>> klusark>I've been trying to build this for the past hour. It requires
>>> folly. folly requires some "double-conversion" library, but you can't
>>> use the default version, you have to build it with scripts from folly's
>>> source. After I finally get folly to get past configure stage I get some
>>> random python error in one of the build scripts. I just gave up at this
>>> point. I'm sure I could get it working, but the time isn't worth it.<
>>>
>>> Bye,
>>> bearophile
>>
>> Ironically that's for the obsoleted C++ program. The D program is
>> trivial to build.
>>
>> Andrei
>
> Somewhat related, what ideas in Folly do you think we should borrow for
> Phobos?
>
> It seems like there is a lot of nice stuff in there:
> https://github.com/facebook/folly/blob/master/folly/docs/Overview.md

I like throwErrno and friends a lot.

Andrei
February 26, 2014
On Wednesday, 26 February 2014 at 00:57:55 UTC, deadalnix wrote:
> Usually, I understand XXX evangelist as "My job is to use
> twitter".

Oh, so _that's_ why the text of the Bible comes in individual numbered verses of less than 140 characters each!
February 26, 2014
On Wednesday, 26 February 2014 at 01:47:24 UTC, Andrei Alexandrescu wrote:
> I like throwErrno and friends a lot.

What's that? git grep over folly's repo comes up with 0 results.

Is this like our cenforce? (I think it should be made public.)
February 26, 2014
On Tuesday, 25 February 2014 at 22:37:46 UTC, Walter Bright wrote:
> On 2/25/2014 7:36 AM, Paulo Pinto wrote:
>> Yeah, it worked really great for C.
>>
>> Developers created C compilers in other systems and never ported lint
>> as part of the process.
>>
>> End result being a portable macro assembler, as safe as, writing in pure assembly.
>
> This is hyperbole. C's type system made it far safer than assembler.

Of course you are right about it, but that is how I personally look to C,
given my experience with Turbo Pascal, Modula-2 and Oberon for the same purposes.

--
Paulo
February 26, 2014
On Tuesday, February 25, 2014 12:48:17 Dicebot wrote:
> On Tuesday, 25 February 2014 at 11:20:37 UTC, bearophile wrote:
> > Currently the D compiler catches several bugs that are caught only by C lints. Clang shows that you can add lot of lint-like tests to the compiler. I'd like some more tests in the D compiler.
> 
> Full stop. It should be other way around - remove all such arguable warnings from compiler to dedicated lint tool and never add any single one to compiler.

+1

- Jonathan M Davis
February 26, 2014
On 2014-02-25 15:53, Adam D. Ruppe wrote:
> I'd like to point out a cool fact: with D, we can do a number of lint
> like things in the language itself, especially if we extend rtinfo (I
> wrote about this a little while ago and might do a pull request soon)

One thing you cannot do is anything about the formatting of the source code.

-- 
/Jacob Carlborg
February 26, 2014
On 02/25/2014 06:53 PM, Walter Bright wrote:
> On 2/25/2014 3:40 PM, Andrei Alexandrescu wrote:
>> Ironically that's for the obsoleted C++ program. The D program is
>> trivial to build.
>
> Maybe the C++ version should undergo a git rm :-)
>
> Or at least, put it on another branch.
>

+1
February 28, 2014
On Monday, 24 February 2014 at 21:07:00 UTC, Andrei Alexandrescu wrote:
> https://news.ycombinator.com/item?id=7293396
> http://www.reddit.com/r/programming/comments/1yts5n/facebook_open_sources_flint_a_c_linter_written_in/

The relevant link on D_Programming twitter (https://twitter.com/D_Programming/status/438089226685399040) points to www.facebook.com/... instead of code.facebook.com/... and thus gives error 404.