Jai - interesting programming language

BLM768 via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 19 23:15:07 PDT 2016


On Saturday, 19 March 2016 at 08:38:20 UTC, Basile B. wrote:
>
> Otherwise there's something that's pretty in the syntax:

Very much so. My own "toy language" project uses (well, _will_ 
use once I have more than 5% of a parser) a similar syntax, so it 
could just be my own biases talking, but I like it.

>
> However later in the function declaration:
>
> "sum := (x: float, y: float, z: float) -> float {
>     return x + y + z;
> };"
>
> I would expect the same system as for variables:
>
> "sum : float = (x: float, y: float, z: float) {
>     return x + y + z;
> };"
>
> or return type inference:
>
> "sum := (x: float, y: float, z: float) {
>     return x + y + z;
> };"

As far as the second example goes, sum is a function returning 
float, not a float variable. I could be wrong, but it appears to 
me that using variable-like syntax would make the grammar (or at 
least its semantics) less context-free. Plus the () -> type {} 
syntax works nicely for lambdas. I'm sure the type-inference 
option could be supported, though.

The language has some very interesting ideas. I probably wouldn't 
use it for general-purpose programming, though. I like my OOP, at 
least when it fits the problem at hand.




More information about the Digitalmars-d mailing list