Drools 7 Java-like Language

Version 2

    Drools 7 will look to extend a java compiler, with few basics - to create a single language. That is able to compile all java code too. It will target java8 as the base layer.

     

    Property Accessors

    Fields can be annotated to turn them into properties, with getters/setters generated. Compact property accessors is needed for a compact language.

    @Getter @Setter
    String name;
    

     

    or

    @Property(getter=true, setter=true)
    String name;
    

     

    person.name == "mark"
    

    Inline Casts

    Pattern languages need to be readonabel, so # was added for inline casts, it can also be used for unit co-ercion.

    address#LongAddress.stree = "xxxx"
    

     

    Units

    distance = 10#km + 5#m
    

     

    Multiline Strings

    String s = """
    blah
    blah
    blah
    """;
    

     

    Modify Blocks

    Modify blocks are needed inside of consequences, but ideally they should available in normal java code too. Will need to think how the later looks in normal java code, and could it be made to work with generic resources?

    modify( var ) { name = "xxx", age = 35 }
    

     

    Type Inference

    'var' can be used to ommit type, but some argue that this is actually pointless, and it's better people think in terms of interfacs that concrete classes. So I'll leave this one open to debate for now.

     

    Relational View Literals

    This is basically drools LHS literals, for linq like problems. This is covered on a separate page for layered languages:

    Layered Language

     

    .Net Style Event Handling Sugar