On 11/16/15, 3:22 AM, "Michael Schmalle" <teotigraphix...@gmail.com> wrote:

>On Mon, Nov 16, 2015 at 6:07 AM, Harbs <harbs.li...@gmail.com> wrote:
>
>> It would actually be very nice if there was some way to (optionally)
>> prevent null being passed into constructors and function calls. There
>>has
>> been more than once that I would have liked to have that feature.
>>
>> I wonder if that’s something we can add to Falcon?
>>
>
>It could be done but there would have to be some kind of config either in
>the compiler args or @param tag like @param arg0 !null Foo desc, or
>metadata tag with param names for not null params.
>
>The AST has the null identifier and you can tell if it's being passed in a
>Function/Method call at compile time.

Yep, but again, it is only as good as your strong-typing of your code.
And won’t help you at all if you use modules in distributed development
since they can’t be cross-checked at compile-time.

And the compiler only knows that null is being passed in if it is a
literal.  No way to know the value of a property is null without more
control-flow checking in the compiler.

The counterpart is to open the door to preprocessors and macros in the
compiler, so the compiler would inject runtime checking code with less
keystrokes.

-Alex

Reply via email to